为了账号安全,请及时绑定邮箱和手机立即绑定

C#中=>是什么意思?

C#中=>是什么意思?

C#
人到中年有点甜 2018-07-30 17:17:34
var u = Ct.ACCOUNT.FirstOrDefault(c => c.name == id && c.password == pwd);
查看完整描述

2 回答

?
哆啦的时光机

TA贡献1779条经验 获得超6个赞

=>是兰姆达表达式

g => g.Update(location) 的意思是一个函数,把这个函数按照传统方法展开是这个样子

void Func(GeoService g)
{
g.Update(location);
}

_geoServices.ForEach(g => g.Update(location)); 完全展开是这个样子

foreach(GeoService g in _geoServices)
{
g.Update(location);
}

ForEach是一个IEnumable的扩展方法,定义在其他地方,你没有列出来

兰姆达是.net 3.5的新语法

查看完整回答
反对 回复 2018-08-05
  • 2 回答
  • 0 关注
  • 1449 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信