Wednesday, June 01, 2005

Use of Reflection in .NET to create classes at runtime (from scratch)

Just as reflection can be used to retrieve and interpret metadata, it can
be used to construct and "emit" it. The classes found in the System
.Reflection.Emit namespace allow metadata for new types to be generated
in memory and used at runtime. In fact, you can dynamically create
an entire assembly, its classes and methods, and the IL code behind them.
The "in memory" assembly can then be used by other applications.

Good examples and articles can be found at :

Another cool example that reads a text file and compiles and executes the class is available at:

No comments:

Post a Comment