We can notice many methods take Action,Fun or any specific delegate as parameters.
When an Action Delegate or Func Delegate appear, what do they mean? What do they signal to the developer?
Action delegate, no matter how many parameters it can take, it returns void.
public delegate void Action<in T1, in T2>(
There are 17 versions of Action delegates ranging from no type parameters up to 16 type parameters. Action, Action<T>, Action<T1,T2>…etc.
Func delegate in contrast, always returns the a value of TResult type.
For example, following is the syntax of a Func with nine arguments. This delegate would expect a value of TResult type.
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult>(
Like Action delegates, Func has 17 versions ranging from no type parameters up to 16 type parameters. Func<TResult>, Action<T, TResult>, Action<T1,T2,TResult >…etc.