![](/img/trans.png)
[英]Why does the “as” operator not use an implicit conversion operator in C#?
[英]Does += operator ensures an EXPLICIT conversion or implicit CASTING in C#?
以下示例编译:
public static void Main()
{
Byte b = 255;
b += 100;
}
但下面的这个失败了
public static void Main()
{
Byte b = 255;
b = b + 100;
}
同
错误1无法将类型'int'隐式转换为'byte'。 存在显式转换(您是否错过了演员?)
这是否意味着对于C#+ =运算符提供了EXPLICIT转换?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.