Action and Func are existing delegates that are generic. I’ll go through the implementation of all the three -Delegate, Action, and Func. After implementing the delegate, you will understand better about Action and Func delegates.
Delegate
It holds the reference of the method.
- public delegate void Write(String value);
- public static void Main() {
- Write write = WriteTheText;
- write("Hello");
- var text = "I enjoyed the movie";
- write(text);
- }
- public static void WriteTheText(string value) {
- Console.WriteLine(value);
- }
- public delegate void Write(String value); - First we are declaring the delegate
- Write write = WriteTheText; - Write is the delegate which has the reference of the“ WriteTheText” method.
- write("Hello"); - We are invoking the delegate.It will call the“ WriteTheText” method and send the parameter“ Hello”.
Action
Now, let’s try the same with Action. Action delegate is the existing delegate. In this, we can pass zero to 16 parameters.


Join the conversation! Your thoughts help the community grow.