C
C#•3y ago
Kippachu

WPF Find Action IDialogResult using it's string name (Reflection)

Hello, is it possible to find an action<IDialogResult> using it's string name ? Like in the picture I can't find a way to make this work... So that I can pass the callBack method using it's name in xaml and have a reusable method, thanks 🙂
2 Replies
Kippachu
KippachuOP•3y ago
I thought it would be a better idea but i don't think it is possible
mikernet
mikernet•3y ago
Sure it is. Assuming the signatures match correctly:
Action<IDialogResult> action = method.CreateDelegate<Action<IDialogResult>>();
Action<IDialogResult> action = method.CreateDelegate<Action<IDialogResult>>();
That's assuming it's a static method. If not you need to provide an instance as a parameter to CreateDelegate(theInstance)
Want results from more Discord servers?
Add your server