Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

Programming C# 2.0, 3.0, 4.

Muhammed Ali Sakhi


Microsoft Certified Trainer

© PakDev.net
Delegates
Delegates are kind user defined data type

Delegates are used to pass functions as


parameters

In the .NET framework, callback methods are


extensively used for several purposes, such as:
events, threading, item filtering and more

© PakDev.net
Delegates
Delegate defines the method signature

Define our method to accept a parameter of the


delegate type defined

Call multiple methods together using multicast


delegates

© PakDev.net
Anonymous Delegates
Inline anonymous methods

No need to create a separate method

© PakDev.net
Delegates

Demo

© PakDev.net
Demonstration Steps
Simple Deleagate

Multicast Delegate

Anonymous Delegates

© PakDev.net
Thank you
PakDev.net

© PakDev.net

You might also like