What is a delegate in C#? Multicast Delegate with Examples

delegate in c#

C# Delegates with Examples

In C#, a  Delegate  is a reference type that is available in system namespace.

A delegate is a wrapper of a function, or simply we can say that it is a Typesafe function pointer which can hold the reference of one or more methods of the same signature and return type.

Syntax to define a delegate in C#

In C#, The declaration of a delegate is very similar to a method signature. It can also have parameters and the return type as a normal method.

Following is the syntax to declare a delegate.

<AccessModifier> delegate <ReturnType> <DelegateName>(<Parameters>)

Continue reading “What is a delegate in C#? Multicast Delegate with Examples”