Im generating some IL with the ILGenerator here is my code:
DynamicMethod method = new DynamicMethod("test", null, Type.EmptyTypes);
ILGenerator gen = method.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldarg_1);
gen.Emit(OpCodes.Ldc_I4_S, 100);
This generated this IL:
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: ldc.i4.s 100
IL_0004: nop
IL_0005: nop
IL_0006: nop
(I get the IL Code from a VS Virtulizer named ILStream)
From where do the nops code? is there any way to get rid of them? Im trying to imitate some c# code and it doesn't have 3 nops.