vendredi 29 juillet 2022

Get specific overload method from Type.GetMethod() in C# [duplicate]

I am trying to get the MethodInfo for the method: EventCallBackFactory.Create<TValue>(Object, Action<TValue>) Documentation can be found here: EventCallBackFactory.Create

The code i am currently running however returns the version without a Type on the action ParameterEventCallBackFactory.Create<TValue>(Object, Action)

Here is my code:

MethodInfo? method = EventCallback.Factory.GetType().GetMethod("Create", 1, new Type[] { typeof(object), typeof(Action)});
MethodInfo genericMethod = method.MakeGenericMethod(new Type[] { PropertyType });

How can i Specify that i want the Overload version with Action<TValue> Parameter in the GetMethod() function?





Aucun commentaire:

Enregistrer un commentaire