public void Bar()
{
Foo foo = new Foo();
**foo.MyEvent += foo_MyEvent;**
foo.FireEvent();
}
void foo_MyEvent(object sender, EventArgs e)
{
(
Event is just the immutable list of delegates (i.e. subscribes which will get called when something publishes/invokes that event). You could argue that we could have used List instead. If we went that way, someone could have tempered with our subscribers.
In above scenario where you use List, you could do:
lstDelegate = newDelegate
and you have wiped existing subscribers (lstDelegate only contains ur delegate callback now).
To stop that behaivour we have Event. When you use event, complier wont allow you do that, you are only allowed to add/remove your own delegate by using += and -=. That's how I try to differentiate it anyway. hope it helps.