我不小心尝试过这个,编译!所以我想知道什么可能这可能意味着谷歌..没有帮助..> +和> - 是什么意思在C#
if (3 >+ 4)
dothis() //this is never hit btw..
if (3 >- 4)
dothis() //this is hit.
两个密码编译顺便说一句..
我不小心尝试过这个,编译!所以我想知道什么可能这可能意味着谷歌..没有帮助..> +和> - 是什么意思在C#
if (3 >+ 4)
dothis() //this is never hit btw..
if (3 >- 4)
dothis() //this is hit.
两个密码编译顺便说一句..
3是否大于4?
比3更大吗?
如果你什么东西是做无疑是有史以来,写一个小的测试应用程序:
int i = +3;
int j = -4;
Console.WriteLine(i);
Console.WriteLine(j);
Console.WriteLine((3 > +4));
Console.WriteLine((3 > -4));
尝试把一个分号dothis后()之类
dothis();
然后看看会发生什么到+和 - 运营商。他们将从大于或小于被移开比叹息并移动更靠近4.
if (3 > +4)
dothis() //this is never hit btw..
//will never hit in the entire universe
if (3 > -4)
dothis() //this is hit
//will always be a hit
首先变得如果3> 4(正4),这将总是导致错误。
如果3> -4(负4)总是成立,则第二个成为真。
想一想。 – leppie 2012-03-31 12:35:47
yea正确地评论了leppie – 2012-03-31 12:36:20
点击'Ctrl + K'' Ctrl + D' – CodesInChaos 2012-03-31 12:36:43