标签:lam class his blog 匿名方法 var turn 方法 ring
匿名类:少了一个类型
var siz = new { id = 1, name = "xiaohua", size = 4, }; Console.WriteLine("{0},{1},{2}", siz.id, siz.name, siz.size);
委托:
public delegate string sd(int a, int b);
委托调用:包括匿名方法的使用
public void show() { sd s = new sd(this.qiu); sd s1 = new sd(delegate (int a, int b) { return (a + b).ToString(); }); Console.WriteLine(s.Invoke(3, 5)); } public string qiu(int a, int b) { return (a + b).ToString(); }
lambda表达式是一个匿名方法
标签:lam class his blog 匿名方法 var turn 方法 ring
原文地址:http://www.cnblogs.com/wy1992/p/7479850.html