Wednesday, January 11, 2012

Differences between event and delegate in C#

I did not realized some of them until I came across this article. In short,

  1. event is a modifier and delegate is a normal type declaration
  2. thus event can be used in interfaces and delegates can not
  3. event can only be accessed by the class defines it, not even the child classes (an in-direct access through protected method is possible), while delegate is more like a member
  4. normally event follows a convention on signature: foo(object source, EventArgs e)

No comments:

Post a Comment