I am trying to convert from a generic delegate to a named delegate.
With the result being in spirit of the following (not valid C#):
Action<CustomClass> act = ???;
CustomDelegate d = act;
I have tried
CustomDelegate d = act.Invoke;
CustomDelegate d = new CustomDelegate( act );
CustomDelegate d = new CustomDelegate( x => act(x) );
CustomDelegate d = new CustomDelegate( act.Invoke );
All of which fail at run time giving an ArgumentException
with the error
Delegate to an instance method cannot have null 'this'.
The top of the stack which is not my code is:
at System.MulticastDelegate.ThrowNullThisInDelegateToInstance()
at System.MulticastDelegate.CtorClosed(object target, IntPtr methodPtr)
How to I convert a delegate such that I do not get an exception?