Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#lambda运算符左侧的(下划线字符)是什么意思?_C#_Lambda - Fatal编程技术网

C#lambda运算符左侧的(下划线字符)是什么意思?

C#lambda运算符左侧的(下划线字符)是什么意思?,c#,lambda,C#,Lambda,C#lambda运算符左侧的(下划线字符)是什么意思?例如: Movment = this.FixedUpdateAsObservable() .Select(_ => { var x = Input.GetAxis("Horizontal"); var y = Input.GetAxis("Vertical"); return new V

C#lambda运算符左侧的(下划线字符)是什么意思?例如:

        Movment = this.FixedUpdateAsObservable()
        .Select(_ =>
            {
                var x = Input.GetAxis("Horizontal");
                var y = Input.GetAxis("Vertical");
                return new Vector2(x, y).normalized;
            }
        );

\u
是当您不需要变量时,它就可以让代码运行

示例:

.Select(_ => ...
.Where(_ => ....
.OrderBy(_ =>

它是一个变量名,就像任何其他有效的标识符都位于该位置一样。有些人以这种方式命名参数,以指示参数不会在lambda的主体中使用。否则,它和其他任何参数一样是一个参数。不能用()代替吗?例如:()=>{}你没有抓住问题的重点。@sstan好的,我更新了我的答案。