Reputation: 41
How do I create an instance of a type I've just created with AssemblyDefinition/TypeDefinition (I mean in runtime)? Currently, I save the created assembly as a file, read it with System.Reflection.Assembly.Load, find the type, find its constructor, and finally call the constructor.
Is there a way to do that entirely in memory without the temporary file?
Upvotes: 1
Views: 537
Reputation: 117320
You could save to memory stream, then load the assembly from the bytes.
Upvotes: 1