What is the problem when declaring events with Action
public interface ISomething
{
event Action MyEventName;
}
or
public interface ISomething
{
event Action<bool> MyBoolEventName;
}
instead of the other variant of the previous code declaring events with EventHandler and 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
{
get { return this.someValue; }
}
}
public interface ISomething
{
event EventHandler<EventArgsWithBool> MyBoolEventName;
}
My thoughts:
Both versions work fine for me and I think the first one is more readable / looks more direct to the point. But some developers say it is better to use the 2nd syntax with EventArgs without being able to give good technical reasons why (other than they know the 2nd syntax).
Are there any technical problems to face when using the first one?