为什么是变种M = 6 + + + + + + + + 6;在C#中有效吗? [英] Why is var m = 6 + + + + + + + + 6; valid in c#?

查看:118
本文介绍了为什么是变种M = 6 + + + + + + + + 6;在C#中有效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题最的问题,是什么使这是有效的代码?有没有可以让我利用这个任何利益或招

Title is most of the question, what allows this to be valid code? Is there any benefit or trick that would allow me to utilize this?

推荐答案

一元再加上运营商具有较高的优先比的此外运营商,只是你表达分割成多个分组表达式和它似乎很明显:

The unary plus operator has higher precedence than the addition operator, just split your expression into multiple grouped expressions and it will seem pretty obvious:

var m = 6 + ( +( +( +( +( +( +( +( 6 ))))))));
      //6 + 6

这篇关于为什么是变种M = 6 + + + + + + + + 6;在C#中有效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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