C#中的> +和>-是什么意思 [英] What does >+ and >- mean in C#

查看:291
本文介绍了C#中的> +和>-是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不小心尝试了这个,可以编译!所以我想知道这可能意味着什么..谷歌没有帮助..

I had accidentally tried this, which compiles! So I was wondering what could this possibly mean.. google didnt help..

if (3 >+ 4)
   dothis() //this is never hit btw..

if (3 >- 4)
   dothis() //this is hit.

两个代码都将进行编译.

Both the code compile btw..

推荐答案

它解析为

3 > +4

3 > -4

因此进入一元+ 一元- 运算符.

So into the unary + and unary - operators.

如果您想以有趣的方式进行探索,请写

If you want an interesting way to explore this, write

Expression<Func<int, int, bool>> func = (x, y) => x >+ y;

,然后在调试器中浏览结果表达式树func.您将在树中看到一元运算符.

and then explore the resulting expression tree func in the debugger. You'll see the unary operator in the tree.

这篇关于C#中的&gt; +和&gt;-是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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