Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Back to Basics:
Delegates
Rob Hale
April 21, 2014
Goals
● Delegation pattern review
● Delegates in C#
Delegation
Design Pattern
Delegation design pattern - simple
Delegator Delegatee
Delegation design pattern
- slightly more complicated
Delegator IDelegatee
Concrete
Delegatee1
Concrete
Delegatee2
Coding time...
Delegates in C#
What are Delegates?
● Delegates are a reference type that defines
a method signature
○ Like C++ function pointers but are ...
Coding Time...
Resources
Code from this presentation
● https://github.
com/robhalevt/20140421_VTdotNET_DelegationAndDelegates
Other readi...
Upcoming SlideShare
Loading in …5
×

VT.NET user group 2014-04-21: Delegation and C# delegates

759 views

Published on

Slides from my April 2014 presentation to the Vermont .NET user group.

Published in: Software, Technology
  • Be the first to comment

  • Be the first to like this

VT.NET user group 2014-04-21: Delegation and C# delegates

  1. 1. Back to Basics: Delegates Rob Hale April 21, 2014
  2. 2. Goals ● Delegation pattern review ● Delegates in C#
  3. 3. Delegation Design Pattern
  4. 4. Delegation design pattern - simple Delegator Delegatee
  5. 5. Delegation design pattern - slightly more complicated Delegator IDelegatee Concrete Delegatee1 Concrete Delegatee2
  6. 6. Coding time...
  7. 7. Delegates in C#
  8. 8. What are Delegates? ● Delegates are a reference type that defines a method signature ○ Like C++ function pointers but are type safe ○ Unlike method overloading, the return type is part of the signature ● They allow methods to be passed as parameters ● They can be used to define callback methods ● They can be chained together ○ For example, multiple methods can be called on a
  9. 9. Coding Time...
  10. 10. Resources Code from this presentation ● https://github. com/robhalevt/20140421_VTdotNET_DelegationAndDelegates Other reading ● http://msdn.microsoft.com/en-us/library/vstudio/ms173171(v=vs.100).aspx ● http://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx ● http://en.wikipedia.org/wiki/Delegation_pattern ● http://stackoverflow.com/questions/2044301/what-is-delegate

×