Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of


Creating an emitter is not especially difficult, although it requires meticulous attention to detail, and it is a bit tedious to write all the individual lines of IL code. If you like inventing, however, the Reflection.Emit namespace is a great playground.

If you're writing emitters for profit, you'll probably want to use the CodeDom. The CodeDom has higher-level constructs and can emit C#, Visual Basic .NET, or any language that has a provider. Generating code and assemblies for profit can be accomplished with a lot less code (and more quickly) using the CodeDom. Of course, the CodeDom would not exist without the classes in the Emit namespace, and the CodeDom ultimately emits MSIL when you compile code generated with the CodeDom. This relationship between the Emit namespace and the CodeDom demonstrates that .NET has been used and is being used to extend .NET. This capability is an important and critical indicator of a first-class tool.

If you want to learn more about reflection, emitting, and the CodeDom, see my books The C# Developer's Guide (Osborne/McGraw-Hill, available late summer 2002) and The Visual Basic .NET Developer's Book (Addison-Wesley, available early fall 2002) for extensive examples.

Viel Spaß! (Have fun!)

  • + Share This
  • 🔖 Save To Your Account