您的位置:首页 > 编程语言 > C#

c# lambda表达式学习(1)

2017-07-28 15:08 441 查看

using System;

using System.Collections.Generic;

using System.Linq;

using System.Linq.Expressions;

using System.Text;

namespace ConsoleApplication1

{

class Program

{

delegate int MyData(int x, int y); //定义委托

static void Main()

{

//定义lamda表达式, => 是lamda表达式符号,读作goes to。右边的内容相当于匿名函数,如果有多行,请用{}包起来。

MyData mydata = (x, y) => 10 * x + y;

int val = mydata(5, 8);

Console.Write(val);

Console.Read();

}

}

}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c# lambda lambda表达式