• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
12   events and delegates
 

12 events and delegates

on

  • 713 views

 

Statistics

Views

Total Views
713
Views on SlideShare
713
Embed Views
0

Actions

Likes
0
Downloads
32
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    12   events and delegates 12 events and delegates Presentation Transcript

    • Events andDelegates Programming in C# tnngo2@gmail.com
    • Delegates
    • 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.
    • 1. Declaring delegates2. Create the method to be referenced3. Instantiating delegates4. Callhttps://gist.github.com/2427445
    • Anonymous methods
    • Events
    • Events a way for a class to provide notifications to clients of that class when some interesting thing happens to an object.
    • 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