SlideShare a Scribd company logo
1 of 7
Delegates & Events
Melick R. Baranasooriya
http://melick-rajee.blogspot.com/
Delegate is ?
•   Reference to a method
•   Similar to Function pointers in c++
•   Implement run time functionality
•   very flexible
•   reusable,
•   Implement different functionality in run time
•   Implement Events
       • Event ?
Simple Delegate
• Declaring a Delegate



• Create Delegate Reference



• Point to a Method



• Execute
Delegate with Para
• Declaring a Delegate



• Create Delegate Reference



• Point to a Method



• Execute
Simple Event
• Declare Delegate

• Declare Corresponding Event

• Call the Delegate when needed (raise the event)



• Catch the event in the program
Event with Parameters
• Declare Delegate

• Declare Corresponding Event

• Call the Delegate when needed (raise the event)



• Catch the event in the program
THANK YOU!

More Related Content

Viewers also liked

Delegates and events
Delegates and eventsDelegates and events
Delegates and eventsIblesoft
 
Share point developement Introduction for students
Share point developement Introduction for studentsShare point developement Introduction for students
Share point developement Introduction for studentsMelick Baranasooriya
 
SharePoint 2013 variations feature
SharePoint 2013 variations featureSharePoint 2013 variations feature
SharePoint 2013 variations featureMelick Baranasooriya
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsMohammad Shaker
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
12 events and delegates
12   events and delegates12   events and delegates
12 events and delegatesTuan Ngo
 

Viewers also liked (13)

App deployment
App deploymentApp deployment
App deployment
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Delegates and events
Delegates and eventsDelegates and events
Delegates and events
 
Share point developement Introduction for students
Share point developement Introduction for studentsShare point developement Introduction for students
Share point developement Introduction for students
 
Apps for SharePoint 2013
Apps for SharePoint 2013Apps for SharePoint 2013
Apps for SharePoint 2013
 
SharePoint 2013 variations feature
SharePoint 2013 variations featureSharePoint 2013 variations feature
SharePoint 2013 variations feature
 
C# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension MethodsC# Starter L06-Delegates, Event Handling and Extension Methods
C# Starter L06-Delegates, Event Handling and Extension Methods
 
Infopath controls
Infopath controlsInfopath controls
Infopath controls
 
Delegates and events
Delegates and events   Delegates and events
Delegates and events
 
Beginners SharePoint introduction
Beginners SharePoint introductionBeginners SharePoint introduction
Beginners SharePoint introduction
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
12 events and delegates
12   events and delegates12   events and delegates
12 events and delegates
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Events & delegates

  • 1. Delegates & Events Melick R. Baranasooriya http://melick-rajee.blogspot.com/
  • 2. Delegate is ? • Reference to a method • Similar to Function pointers in c++ • Implement run time functionality • very flexible • reusable, • Implement different functionality in run time • Implement Events • Event ?
  • 3. Simple Delegate • Declaring a Delegate • Create Delegate Reference • Point to a Method • Execute
  • 4. Delegate with Para • Declaring a Delegate • Create Delegate Reference • Point to a Method • Execute
  • 5. Simple Event • Declare Delegate • Declare Corresponding Event • Call the Delegate when needed (raise the event) • Catch the event in the program
  • 6. Event with Parameters • Declare Delegate • Declare Corresponding Event • Call the Delegate when needed (raise the event) • Catch the event in the program