I need to create a delegate type with a parameter refat runtime.
If I knew the type of the parameter at compile time, I could use an explicit declaration of the delegate type, for example:
delegate void VoidDelSRef (ref S s);
Type td = typeof (VoidDelSRef);
This type is tdused to create a C # 4 expression tree that compiles into a delegate.
Since the code in my expression tree changes the parameter s, I need to pass sby reference.
I need to support any type s, so I cannot use an explicit declaration of the delegate type, because I only have Type ts = typeof (S)its reftype Type tsr = ts.MakeByRefType ().
I tried to use Expression.GetActionType (tsr), but does not allow types ref.
How to create a delegate with parameters refat runtime?
source
share