You can use the DynamicMethod class to generate
and execute a method at run time, without having to generate a dynamic assembly
and a dynamic type to contain the method. The executable code created by the
just-in-time (JIT) compiler is reclaimed when the DynamicMethod object is reclaimed. Dynamic methods are the
most efficient way to generate and execute small amounts of code.
A dynamic method can be anonymously hosted, or it can be logically associated
with a module or with a type.
Source: http://msdn2.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx
.NET version: 2.0,3.0,3.5