Lambda 简单了解

      //Lambda 

            //匿名方法
            //delegate (Student s) { return s.Age > 12 && s.Age < 20; };
            //Lable 表达式 (代替了上面的)
            //s => s.Age > 12 && s.Age < 20

            //在Lambda Expression 中指定多个参数
            //(s, youngAge) => s.Age >= youngage;
            //指定参数类型
            //(Student s, int youngAge) => s.Age >= youngage;

            //没有参数的Lambda表达式
            //() => Console.WriteLine("Parameter less lambda expression")

            //多语句Lambda表达式
            //(s, youngAge) =>
            //{
            //    Console.WriteLine("Lambda expression with multiple statements in the body");
            //    Return s.Age >= youngAge;
            //}
View Code

相关文章:

  • 2021-06-02
  • 2021-07-27
  • 2021-07-12
  • 2021-12-28
  • 2022-01-01
  • 2021-05-30
  • 2022-12-23
猜你喜欢
  • 2021-10-10
  • 2021-10-12
  • 2021-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-08-24
相关资源
相似解决方案