DispatcherTimer.Tick statement's syntax query

 dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick)

In above statement i want to know why is it += and not just = I tried to find about it alot but just couldn't find any answer to it but just got to know that it triggers an event when a tick timer is completed.

Jon Skeet
people
quotationmark

Tick is an event. .NET events are basically a representation of the pub/sub model. Event handlers subscribe to a particular event. The event publisher can raise the event whenever they like, at which point all the event handlers are called. There can be more than one event handler for any particular event, hence += instead of =.

It's worth understanding that events and delegates are slightly different beasts - although events use delegates to represent the handlers. See my article on the topic for more details.

people

See more on this question at Stackoverflow