Click here to Skip to main content
16,010,201 members
Please Sign up or sign in to vote.
1.80/5 (3 votes)
See more:
Hi all
whats mean += operator in .eventchanged event in control that invoke and what's related to delegate?

which part of complete C# book related to this subject ?

thanks a lot.
Posted

It's the syntax used to add an event handler to the chain of existing handlers.
See here: https://msdn.microsoft.com/en-gb/library/aa645739%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396[^]

[edit]typo: "an" for "add"[/edit]
 
Share this answer
 
v2
Comments
bernova 6-Sep-15 3:31am    
Thanks a lot.
OriginalGriff 6-Sep-15 3:42am    
You're welcome!
Kornfeld Eliyahu Peter 6-Sep-15 3:32am    
Opened a reading class this morning? :-)
OriginalGriff 6-Sep-15 3:42am    
:laugh:
bernova 6-Sep-15 3:42am    
what do you mean?
+= adds the delegate to the internal list of handlers for the event and -= removes it from the list.

Here is a detailed explanation by John Skeet
Delegates and Events in C#[^]
 
Share this answer
 
The operator adds an event handler to the invocation list of some event instance. Interestingly, the added element is a delegate instance, which has its own invocation list. But implementation of the operator if quite non-trivial; it does not produce a tree structure. For further detail, please see this section of my article
Dynamic Method Dispatcher, 4.1 On the Nature of Delegate Instance.

—SA
 
Share this answer
 
Comments
[no name] 6-Sep-15 10:41am    
I don't have that much 5's but I spend one here because "Dynamic Method Dispatcher" is very helpfull.
Sergey Alexandrovich Kryukov 7-Sep-15 1:45am    
Thank you very much.
—SA
bernova 6-Sep-15 11:10am    
thanks Sergey Alexandrovich Kryukov
Sergey Alexandrovich Kryukov 7-Sep-15 1:46am    
You are very welcome.
—SA
Check Delegates in a book for more information on this topic.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900