List<a> list = new List<a>();
 int i = 1;
string[] count = new string[5];
list.ForEach(c =>{count[i]=c.name;i++;});//这句话是什么意思,因该怎么理解?

解决方案 »

  1.   

    对一个List<T>中每一个对象都进行一个函数操作
    http://msdn.microsoft.com/zh-cn/library/bwabdf9z(VS.80).aspx
      

  2.   


    c =>{}这个怎么理解?
      

  3.   

    对c的操作,Lambda表达式
    var ints = new int[] { 1, 2, 3 };
                Array.ForEach(ints.ToArray(), n => Console.WriteLine(n * 2));
                /*
                 2
                 4
                 6
                 */
      

  4.   

    所有 Lambda 表达式都使用 Lambda 运算符 =>,该运算符读为“goes to”。 该 Lambda 运算符的左边是输入参数(如果有),右边包含表达式或语句块。 Lambda 表达式 x => x * x 读作“x goes to x times x”。可以将此表达式分配给委托类型
    http://msdn.microsoft.com/zh-cn/library/bb397687.aspx