c# - Why base parameters to custom EventHandlers from EventArg -


to

Although you have defined the events of defined classes on any valid representative type Even the representatives also return the values, it is generally recommended that you base your event on the net framework pattern using EventHindler, as shown in the following example.

Why? How about:

  Public representative Zero GenericEventHandler & lt; Ttype, TArgs & gt; (TType sender, TArgs args); Public event Generic Event Handler & lt; Some senders, fewer & gt; SomeEvent;  

Mainly so that anyone with the signature (Object Sender, EventArgs E) Method can control your event Keep in mind that reps are different (type of communal withdrawal and contravariant logic type).


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -