-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
HI,
in the pr AvaloniaUI/Avalonia#15274. I have need to retrieve Interactive.AddHandler<TEventArgs>
method. To do this, I tried using IXamlType.FindMethod
and checking if the method name is AddHandler`1 without success.
After investigation I found following workaround
AddHandlerT = Interactive.FindMethod(m => m.IsPublic
&& !m.IsStatic
&& m.Name == "AddHandler"
&& m.Parameters.Count == 4
&& RoutedEvent.IsAssignableFrom(m.Parameters[0])
&& m.Parameters[0].GenericArguments?.Count == 1 // This is specific this case workaround to check is generici method
&& (cfg.WellKnownTypes.Delegate).IsAssignableFrom(m.Parameters[1])
&& m.Parameters[2].IsEnum
&& m.Parameters[3].Equals(cfg.WellKnownTypes.Boolean) == true
I would like to make a PR that makes it easier to identify the generic method. There are a few possibilities:
- Add `n to the end of name of generic method, where n is number of generic arguments
- Add property
IsGenericDef
to IXamlMethod - Expose GenericArguments and GenericParameters
- All three previous proposed solutions
What do you think is the best solution?
Metadata
Metadata
Assignees
Labels
No labels