Sunday, March 11, 2018

Tutorial 18 What are delegates ?

What are Delegates ?

Delegate is type safe function pointer. Means the return type of method must be similar to signature of Delegate.


What is the use Delegates in C Sharp?

Just check this and get the concept of programming without delegate in dotnet.


Now we will see the implementation of method PromotedEmployee using delegate.


There are 3 steps in delegate implementation.


A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance.

Delegates are used to pass methods as arguments to other methods. Event handlers are nothing more than methods that are invoked through delegates. You create a custom method, and a class such as a windows control can call your method when a certain event occurs.

How to implement alternative way of Delegate using Lambda Expression ?


Lambda Expression :
1. it means  => such as 
and this is called expression >= 

1 comment: