What is the difference between

public delegate void SecondChangedHandler(Object clock, TimeInfoEventArgs ti);
public event SecondChangedHandler OnSecondChanged;


public event EventHandler<TimeInfoEventArgs> OnSecondChanged;

When should you use which and is there any best practice?


Before generics the first approach was the only option to declare an event handler delegate. Since generics were introduced in .NET 2.0, EventHandler<T:EventArgs> is the preferred way. Semantically there is no difference between them.


There is no difference indeed. Then EventHandler<T> (msdn) has just been added as a "shortcut" to avoid having to redeclare the delegate.

  • +1 - It is indeed to avoid having to redeclare the delegate. – Karthik Sreenivasan Feb 21 '12 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.