【发布时间】:2012-10-10 11:44:07
【问题描述】:
可能重复:
C# XOR on two byte variables will not compile without a cast
为什么在此 C# 代码中出现编译错误?
void test()
{
ushort a = 0;
ushort b = 0;
ushort c = a ^ b; //ERROR
}
错误 CS0266:无法将类型“int”隐式转换为“ushort”。存在显式转换(您是否缺少演员表?)
【问题讨论】:
标签: c# implicit-conversion xor ushort