var body = new MethodBody(method);
var ins = body.Instructions;
ins.Add(Instruction.Create(OpCodes.Ldc_I4, 2012));
ins.Add(Instruction.Create(OpCodes.Ldc_I4_1));
ins.Add(Instruction.Create(OpCodes.Ldc_I4_S, 18));
I don't know how to write new obj instance statement.
what's the error msg that you saw? maybe you have to import the class first?
http://questiontrack.c ...
Thanks
I got it sorted out.
Here is the missing code.
var dateTimeConstructorMethod = typeof(DateTime).GetConstructor(new[] { typeof(int), typeof(int), typeof(int) });
var dateTimeConstructor = method.Module.Import(dateTimeConstructorMethod);
ins.Add(Instruction.Create(OpCodes.Newobj, dateTimeConstructor));