This question already has an answer here:
- Cast delegate to Func in C# 8 answers
I have the following delegate defined:
public delegate object MyDelegate(dynamic target);
And I have a Func<dynamic, object>
object:
Func<dynamic, object> myFunc
How can I convert myFunc
to MyDelegate
?
I have tried these instructions, none of them worked:
MyDelegate myDeleg = myFunc;
MyDelegate myDeleg = (MyDelegate) myFunc;
MyDelegate myDeleg = myFunc as MyDelegate;