Action无返回值
Action<string> greet = name =>//无返回值所以Action<输入类型> { string greeting = $"Hello {name}!"; Console.WriteLine(greeting); }; greet("World");//调用
Func有返回值
Func<int,string,string> as1 = (int age, string namf) => namf;//有返回值所以Action<输入类型,。。。,输出类型> Console.WriteLine(as1(12,"a")); Console.ReadLine();
本文来自博客园,作者:阿霖找BUG,转载请注明原文链接:https://www.cnblogs.com/lin-07/p/17549828.html