Action 泛型委托和Func 泛型委托的区别是前者不带返回值,后者指定返回值类型
两者都有多个变体,最多可包含16个参数
如下是Action 类型和一些变体:
public delegate void Action();
public delegate void Action<in T>(T arg);
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
// Other variations removed for brevity.
如下是Func 类相关和一些变体,其最后一个类型参数(Tresult)是指定的返回值:
public delegate TResult Func<out TResult>();
public delegate TResult Func<in T1, out TResult>(T1 arg);
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
// Other variations removed for brevity
还有 Predicate<T>委托类型,和Func相似‘
以上请看官网:强类型委托 | Microsoft Docs