1

Possible Duplicate:
Why do we need the “event” keyword while defining events ?

in the MSDN exemple : http://msdn.microsoft.com/fr-fr/library/w369ty8x(v=VS.80).aspx

If i delete the event keyword from the publisher class, my project work. so wy we add the key word event.

thanks

Community
  • 1
  • 1
belhajaa
  • 23
  • 4
  • 1
    To make this a question you'll have to show what does _not_ work with the event keyword. Now it looks like you solved one error by making another one. – H H Mar 28 '11 at 12:43

1 Answers1

2

Because of encapsulation. If keyword 'event' will be removed then you will be able to invoke 'event' and even change it's subscriptions from external classes which do not own the event. See Jon's answer here. With event keyword you're sharing an event, without it you're giving an access to delegate.

Community
  • 1
  • 1
Snowbear
  • 16,924
  • 3
  • 43
  • 67