Action:无返回值,可以包含16种参数;
Func:有返回值,也可以包含16种参数,一共17种;
Predicate:表示定义一组条件并判断参数是否符合条件。
class Program { delegate int AddHandler(int i, int j); delegate void PrintHandler(string msg); static void Main(string[] args) { AddHandler add = Add; PrintHandler print = Print; print(add(34, 56).ToString()); Console.WriteLine(); Func<int, int, int> add01 = Add; Action<string> print01 = Print; print01(add01(1, 56).ToString()); } static int Add(int a, int b) { return a + b; } static void Print(string msg) { Console.WriteLine(msg); } }
标签:string,委托,int,msg,Add,static,Print,声明 From: https://www.cnblogs.com/wen-chen/p/16993739.html