CreateType missing from TypeBuilder. How to port this?

半城伤御伤魂 提交于 2019-12-10 01:47:48

问题


Trying to port an application from .net 4.5 to .net core for a client. I'm noticing that CreateType is no longer part of TypeBuilder. I've searched through multiple of the new reflection libs with no luck. Does anyone know how to port this?

Code in question:

typeBuilder.CreateType()

回答1:


I found the answer, but in a different repository than I expected. CreateType was dropped, and CreateTypeInfo should be used now per this:

https://github.com/dotnet/coreclr/issues/2222

'TypeBuilder' does not contain a definition for 'CreateType' and no extension method 'CreateType' accepting a first argument of type 'TypeBuilder' could be found (are you missing a using directive or an assembly reference?)

Use typeBuilder.CreateTypeInfo() instead.

Hope this saves someone else time.



来源:https://stackoverflow.com/questions/37488458/createtype-missing-from-typebuilder-how-to-port-this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!