An event using a generic EventHandler <> is not displayed in Designer

I just noticed that if I add an event using a common event handler to my UserControl, this event will not be visible in the constructor when I add a user control to the form.

 public event EventHandler<TEventArgs<int>> EventNotVisibleInDesigner; public event EventHandler EventVisibleInDesigner; 

Not particularly worried, but is it design / normal, or am I doing something wrong?

+4
source share
1 answer

Windows Forms Designer has limited support for generic types. It will work fine if you avoid the generic type argument for EventHandler<T> :

  public class TEventArgs<T> : EventArgs { } public class MyEventArgs : TEventArgs<int> { } public event EventHandler<MyEventArgs> EventNowAlsoVisibleInDesigner; 
+7
source

All Articles