Generically creating a delegate from a MethodInfo with parameter upcasting
I am trying to create a delegate of type
The tldr, i want to take method
In this example im just calling
TDelegate that allows me to invoke a MethodInfo instance with some upcasted parameters. A simple example of what i want is as follows:The tldr, i want to take method
void SomeFunction(object param) and create a delegate Action<int>... genericallyIn this example im just calling
MethodInfo::CreateDelegate<TDelegate>() - which fails. This is fine, i expect and understand why this happens. I'm just looking for ideas to achieve what im looking for.
CreateDelegateWithCasting helper method is called - which is where my problem lies.