“"的替代方案在C#中 [英] Alternative of ">>>" in C#
本文介绍了“"的替代方案在C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int i1 =(-4000>>> 4));
int i =(-4000>> 4));
如果要更改>>> ;,我有2行代码.将运算符转换为>>运算符,然后我麻烦了,因为它只接受无符号变量. c#不支持>>>该运算符,则我必须使用>>运算符,并存储>>>的相同结果.该运算符.
我想更改的内容.请帮帮我.
int i1 = (-4000 >>> 4));
int i = (-4000 >> 4));
I have 2 line of code, if i want to change >>> shift operator to >> operator, then i trouble, because it take only unsigned variable. how we got signed value result.The c# not support >>> this operator, then i have to use >> operator, and store the same result of >>> this operator.
What i want to change.pls help me.
推荐答案
您好,
查看此帖子.如果不让我们知道,这可能会有所帮助
http://social.msdn.microsoft.com /Forums/zh-CN/csharpgeneral/thread/6c892d10-75ff-4f4e-a555-3017f72ec170/ [ http://social.msdn.microsoft.com/论坛/en-CA/csharplanguage/thread/d639ee2e-44ac-4e7d-9f19-7ee2414f9631 [ http://msdn.microsoft.com/en-us/library/6a71f45d% 28vs.71%29.aspx [ ^ ]
Hello there
Check Out This Post. This May Be Helpful If Not Let Us Know
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/6c892d10-75ff-4f4e-a555-3017f72ec170/[^]
or
http://social.msdn.microsoft.com/Forums/en-CA/csharplanguage/thread/d639ee2e-44ac-4e7d-9f19-7ee2414f9631[^]
as c#.NET do not have any Unsigned Right Shift Operator. you can find the more details of the operators possible in C#.NET :
http://msdn.microsoft.com/en-us/library/6a71f45d%28vs.71%29.aspx[^]
best regards.
在C#中,只需使用按位移位运算符<<"和>>".谁告诉你签名号码有问题?该操作是为int
定义的,已签名.您的第二行将正常工作(如果您卸下了多余的支架!).
—SA
In C#, just use bitwise shift operators "<<" and ">>". Who told you there is any problem with signed numbers? The operation is defined forint
, which is signed. You second line will work correctly (if you remove extra bracket!).
—SA
这篇关于“"的替代方案在C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文