If you want to generate class dynamically you can use CodeDom or Reflection.Emit. CodeDom creates C# code dynamically and then compiles it whereas Reflection.emit creates MSIL for the code. If you want to write in IL you can just create this class like you do normally and then use ILDASM.exe
to decompile your class into IL. Now that you know what your code should be like in IL you can generate your class dynamically using Reflection.emits
ILGenerator` class. For step by step process please refer this article: http://www.codeproject.com/Articles/121568/Dynamic-Type-Using-Reflection-Emit
Hope it helps you.