c#3.0表达式的含义()=> [英] c# 3.0 Meaning of expression ()=>

查看:67
本文介绍了c#3.0表达式的含义()=>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此表达式()=>"的含义是什么.我看过它在构造函数中使用过:

What is the meaning of this expression " () =>". I have seen it used in a constructor:

return new MyItem(itemId, () => MyFunction(myParam));

谢谢

推荐答案

这是不带参数的委托,写为lambda.与

It's a delegate without parameters, written as a lambda. Same as:

return new MyItem(itemId, delegate() {return MyFunction(myParam); });

这篇关于c#3.0表达式的含义()=>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆