I am currently working with generating dynamic types using Reflection.Emit.
I have the majority of what I need working however need to set default property values in the constructor.
I have so far got this working for Integers and Strings by using for example (reduced for brevity):
ctorDefaultIL.Emit(OpCodes.Ldstr, "Hello World");
ctorDefaultIL.Emit(OpCodes.Ldc_I4, 42);
This works perfectly, my question is how would I go about setting a DateTime value.
Thanks @leppie for future ref here’s the code I ended up using.
For some context this is being passed into another method: