I am fairly happy with my understanding of the .NET event model. I think I might be misunderstanding a small nuance of the system.
When I started out putting events into my classes I would use the standard way like so:
public event EventHandler<MyEventArgs> MyEvent; This meant that anything subscribing to the event would need a method like:
void HandleThatEvent(object sender, MyEventArgs args){...} Which is nice, but I found that I would rarely care about the sender, so it made a lot of method signatures bloated.
So I switched to declaring my own delegate types
public delegate void MyEventHandler(SomeClass argument); Which cut down on clutter, but left me with a small problem when it came to writing handlers:
eventImplmentor.MyEvent += HandleThatEvent; . . . void HandleThatEvent(/*oh, um, what arguments does it take? Intellisense isn't telling me*/) So I would have to go back to the declaration of the delegate and look and then go back and write them in, or compile it and wait to be told.
So now instead, I'm just using Action, Action<T> or whatever template fits.
public event Action<SomeClass> MyEvent; So that I can hover over the event and be told what parameters it expects.
My question, after all that: Is there a best practice for declaring events in C#? Should I go back to the EventHandler<T> way, or is Action<T> acceptable?