| 0 | 1 <p>The <b>System.Reflection.Emit</b> namespace provides classes to create dynamic assemblies at runtime. | 
|  | 2 It allows compilers and tools to emit <b>MSIL</b>, execute it and store it to a disk. | 
|  | 3 Although <b>Emit</b> is a powerful tool, it is also extremely hard to use.</p> | 
|  | 4 <p>Let us take a look at the following example, which demonstrates the "normal" way of emit programming:</p> | 
|  | 5 | 
|  | 6 HelloWorld.cs | 
|  | 7 <% ..\..\..\Examples\CS\Reflection.Emit\HelloWorldnormal.cs %> | 
|  | 8 | 
|  | 9 <p>Note that the Emit method takes one parameter as an OpCode and optionally another one, | 
|  | 10 which does not depend on the current operation context. So, this way is not entirely type safe.</p> | 
|  | 11 | 
|  | 12 <p>Fortunately, there is an alternative way. BLToolkit provides a helper class, | 
|  | 13 <a href='/Source/Reflection/Emit/EmitHelper.cs.htm'>EmitHelper</a>, | 
|  | 14 which can make your life a little bit easy. | 
|  | 15 It contains typed wrapper methods for almost all emit commands and allows writing source code | 
|  | 16 that looks similar to <b>MSIL</b>.</p> | 
|  | 17 <p>The following examples show how to use the EmitHelper class with C#, VB.NET, and C++/CLI.</p> | 
|  | 18 | 
|  | 19 HelloWorld.cs | 
|  | 20 <% ..\..\..\Examples\CS\Reflection.Emit\HelloWorld.cs %> | 
|  | 21 Cool!!! Isn't it?<br><br> | 
|  | 22 | 
|  | 23 HelloWorld.vb | 
|  | 24 <% ..\..\..\Examples\VB\Reflection.Emit\HelloWorld.vb %> | 
|  | 25 | 
|  | 26 HelloWorld.cpp | 
|  | 27 <% ..\..\..\Examples\Cpp\HelloWorld.cpp %> |