_=>这个下划线在 Lambda 表达式中是什么意思? [英] _=> what does this underscore mean in Lambda expressions?

查看:18
本文介绍了_=>这个下划线在 Lambda 表达式中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

_=> 这样的 lambda 表达式有什么作用?expr 是什么意思?

_ 作为 lambda 输入的目的是什么?

What is the purpose of _ as input to lambda?

示例:

int count = 0;
list.ForEach(_ => count += 1);

推荐答案

这是当你不关心参数时使用的约定.

That is a convention used when you don't care about the parameter.

这篇关于_=>这个下划线在 Lambda 表达式中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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