Javatpoint Logo
Javatpoint Logo

C# Delegates

In C#, delegate is a reference to the method. It works like function pointer in C and C++. But it is objected-oriented, secured and type-safe than function pointer.

For static method, delegate encapsulates method only. But for instance method, it encapsulates method and instance both.

The best use of delegate is to use as event.

Internally a delegate declaration defines a class which is the derived class of System.Delegate.

C# Delegate Example

Let's see a simple example of delegate in C# which calls add() and mul() methods.


After c1 delegate, Number is: 120
After c2 delegate, Number is: 360
Next TopicC# Reflection

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA