Operator ! can't be applied to operand ushort
本问题已经有最佳答案,请猛点这里访问。
Possible Duplicate:
How do you return 'not uint' in C#?
大家好,我正在尝试将以下内容从VB.NET转换为C#,并且遇到语法错误。
VB.NET:
1 2 3 | Dim CurrentCRC As UInt16 CurrentCRC = &HFFFF CurrentCRC = Not CurrentCRC |
C#:
1 2 3 | UInt16 currentCRC = default(UInt16); currentCRC = 0xFFFF; currentCRC = !currentCRC; |
最后一行给我
的语法错误
Operator '!' cannot be applied to
operand of type 'ushort'
任何帮助将不胜感激!
如果要查找按位的NOT运算符(即,将值中的每一位翻转的运算符),请使用
如果要按位补码,请使用
在c#中,