c# - Heterogenic list of delegates -
Is it possible to create a list of different types of delegates? For example, keep these two representatives in mind:
class MyEventArg1: EventArgs {} class MyEventArg2: EventArgs {} event handler < MyEventArgs1 & gt; Handler1; Eventhandler & LT; MyEventArgs2 & gt; Handler2;
I would like to do something like this:
list & amp; Lt; Event handler & lt; EventArgs & gt; & Gt; Handler = new list & amp; Lt; Event handler & lt; EventArgs & gt; & Gt; (); Handlers.Add ((eventhandler & lt; eventArgs & gt;) handler1); Handlers.Add ((eventhandler & lt; EventArgs & gt;) handler2);
But artists are not possible from one representative to another. My goal is to store delegates in the list to call them; But just to unsettle them.
Thanks
You will be able to do this Thanks to C # 4.0, but then So far you have to find (perhaps) in some other way.
Comments
Post a Comment