C#语法进阶 Lambda
发布时间:2024年01月03日
Lambda
lambda:匿名方法
演变过程:
版本一:
首先创建一个委托:

创建委托需要调用的方法

调用

版本二:匿名方法 没有名字的方法,前面加一个delegate

这样写的话 可以访问局部变量

调用结果:

版本三:=> goes to

其他写法:
使用系统自定义的委托
无参数无返回值

带参数 无返回值

有返回值 无参数

这里只有一个语句 也可以省略大括号

文章来源:https://blog.csdn.net/weixin_43847546/article/details/135358059
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:chenni525@qq.com进行投诉反馈,一经查实,立即删除!