Delegate vs Action vs Func

Traditional way of using Delegate

When we talk about delegate, it is a class of reference type used to encapsulate named or anonymous methods. For creating delegate we write,


Now, using the delegate which is declared can be done as shown below5

Now C# had added a small wrapper to the delegate with the help of Action<in T> delegate.


This delegate was introduced in Framework 2.0. We can now use Action<in T> delegate to pass a method as a parameter without explicitly defining the delegate. The compiler will take care of it. This delegate can accept parameters but without a return type.


Call the delegate using act(4, 5)

Func< T, TResult>

This was introduced in Framework3.5. This delegate is different from Action<T> in the sense that it supports for return value.


To call this delegate we can use

Console.WriteLine(“Using Func<> :” + fn(6, 6));
As it is returning the value. Hope you got the difference.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s