摘要:
delegate运算符创建一个可以转换为委托类型的匿名方法 Action委托与匿名函数使用 Action不带参数: Action greet = delegate { Console.WriteLine("Hello!"); }; greet(); Action<int, double> intro 阅读全文
posted @ 2020-11-27 23:50
懒树懒
阅读(326)
评论(0)
推荐(0)
摘要:
Lamda表达式主要有两种形式: (input-parameters) => expression (input-parameters) => { <sequence-of-statements> 第一种方式会有一个返回值,返回表达式右边的值: 例如: Func<int, int> square = 阅读全文
posted @ 2020-11-27 23:40
懒树懒
阅读(290)
评论(0)
推荐(0)
摘要:
Action有16种重载方法,返回值为void,最多可以有16个参数,最少有0个 有以下几种用法: 常规委托使用方法 using System; using System.Windows.Forms; public delegate void ShowValue(); public class Na 阅读全文
posted @ 2020-11-27 22:25
懒树懒
阅读(295)
评论(0)
推荐(0)
摘要:
Func<TResult> 委托使用法 此委托类型最多有17重重载方法,最多可以带16个参数,最少可以带0个参数 以下是Func<TResult> 委托的常用方法 常见委托使用方法 using System; using System.IO; delegate bool WriteMethod(); 阅读全文
posted @ 2020-11-27 22:17
懒树懒
阅读(264)
评论(0)
推荐(0)

浙公网安备 33010602011771号