A colleague has been writing code and has missed the "event" keyword from his 
event definitions

Eg:

  public class Foo {
        public EventHandler FooChanged;
  }

He appears to be able to subscribe to these "events" in the normal fashion:

  x.FooChanged += new EventHandler(blah)


He asked me what difference the event keyword made and I said I thought it was 
to do with attaching multiple subscribers, but I must admit I was surprised 
that the "+=" syntax above worked.  I would have expected that since 
EventHandler is a delegate he would have had to have used just a normal 
assignment instead to make it work.


Can anyone give me the real story here?


Best wishes
James

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to