c# - Difference between event Action and event EventHandler<EventArgs> -


this question has answer here:

what problem when declaring events action

public interface isomething {     event action myeventname; } 

or

public interface isomething {     event action<bool> mybooleventname; } 

instead of other variant of previous code declaring events eventhandler , eventargs

public interface isomething {      event eventhandler<eventargs> myeventname; } 

or

public class eventargswithbool : eventargs {     private readonly bool somevalue;      public eventargswithbool (bool somevalue)     {         this.somevalue = somevalue;     }      public bool somevalue     {         { return this.somevalue; }     } }  public interface isomething {      event eventhandler<eventargswithbool> mybooleventname; } 

my thoughts:

both versions work fine me , think first 1 more readable / looks more direct point. developers better use 2nd syntax eventargs without being able give technical reasons why (other know 2nd syntax).

are there technical problems face when using first one?

when use action, not passing sender object event handler. useful event handler know object triggered event.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -