C# Reflection: Emitting classes to existing assemblies

[亡魂溺海] 提交于 2019-12-05 19:09:16

When using Reflection.Emit, you must always create a new assembly.

However, one potential option is to take your existing assembly, and define the contracts as interfaces. You can create the new assembly at runtime with Reflection.Emit, and have it define types that implement your interfaces. Your assembly can use a factory pattern to instantiate the property, dynamically generated type, and return an implementation of your (known at compile time) interface.

Using Reflection.Emit, you define a new assembly.

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