1

When Building a dynamic Assembly with AssemblyBuilder you can create several TypeBuilder instances, and build your type with TypeBuilder.CreateType(). When I have 10 types in my assembly do I have to call this one by one ? Or is there a way to say "create the assembly and 'compile all'".

Since Types might cross reference each other, one Type must be built before the other, therefore a created type is still not a useable type. The Type will be created with references to uncreated Types. If you call CreateType() for each TypeBuilder, everything is fine. Just wondering if there might be simpler way also.

Is there a concept of "Completing" an Assembly, or does it stay always "open" and expects more types to be added ?

Holger
  • 2,446
  • 1
  • 14
  • 13
  • `AssemblyBuilder.Save()` will write out the final assembly and all types need to be created at this point. – thehennyy Nov 27 '19 at 14:13
  • Yes, and the question is about this "need to be completed". Is there a function for that or do I have to do it one by one. – Holger Dec 19 '19 at 11:52
  • 1
    You have to call `TypeBuilder.CreateType()` for all types by yourself. – thehennyy Dec 19 '19 at 12:34

0 Answers0