var typeBuilder = context.Module.Builder.DefineType("MyDynamicType"); typeBuilder.DefineField("myIntField", typeof(int), FieldAttributes.Private); var methodBuilder = typeBuilder.DefineMethod("MyMethod", MethodAttributes.Public, typeof(int), new Type[] { }); var ilGen = methodBuilder.GetILGenerator(); ilGen.Emit(OpCodes.Ldc_I4, 42); ilGen.Emit(OpCodes.Stfld, typeBuilder.GetField("myIntField", BindingFlags.NonPublic | BindingFlags.Instance)); ilGen.Emit(OpCodes.Ret);This example creates a new type called "MyDynamicType" with a private integer field called "myIntField". It then defines a method called "MyMethod" that sets the value of myIntField to 42 and returns it. Package Library: The Mono.CSharp.EmitContext library is part of the Mono.CSharp package.