Lambda 表达式是一种可用于创建"委托"或"表达式目录树"类型的"匿名函数"。Lambda 表达式对于编写 LINQ 查询表达式特别有用。

左侧指定输入参数(如果有);[2]然后在另一侧输入表达式或语句块。

x 的平方值。

 

delegate int del(int i);
static void Main(string[] args)
{
    del myDelegate = x => x * x;
    int j = myDelegate(5); //j = 25
}
View Code

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2021-04-29
  • 2022-01-23
  • 2021-06-10
  • 2021-08-08
  • 2021-12-02
  • 2021-11-15
猜你喜欢
  • 2021-06-17
  • 2021-08-16
  • 2021-09-23
  • 2022-12-23
  • 2023-01-29
  • 2021-06-21
相关资源
相似解决方案