// 匿名方法
delegate (string x) { return x.Length; }
// 转为lambda表达式
(string x)=>{ return x.Length; }
// 单个表达式不要求大括号
(string x) => x.Length;
// 让编译器判断参数类型
(x) => x.Length;
// 去除不必要的括号
x => x.Length;
匿名方法到lambda表达式的简化过程
最新推荐文章于 2022-06-09 14:28:00 发布