12 events and delegates

889 views

Published on

Published in: News & Politics, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
889
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
50
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

12 events and delegates

  1. 1. Events andDelegates Programming in C# tnngo2@gmail.com
  2. 2. Delegates
  3. 3. Delegates are objects that contain references to method that need to beinvoked instead of containing the actual method names. call any method, which is identified only at runtime. to associate a delegate with a particular method, the method musthave the same return type and parameter type as that of the delegate.
  4. 4. 1. Declaring delegates2. Create the method to be referenced3. Instantiating delegates4. Callhttps://gist.github.com/2427445
  5. 5. Anonymous methods
  6. 6. Events
  7. 7. Events a way for a class to provide notifications to clients of that class when some interesting thing happens to an object.
  8. 8. Implement Events 1. Define a public delegate for the event 2. Create the event using the delegate 3. Subscribe to listen and handle the event 4. Raise the event https://gist.github.com/2427324

×