编译器警告(等级 2)CS0652
与整数常量比较无意义;该常量不在“type”类型的范围之内
编译器检测到常量和变量之间的比较,其中常量不在变量范围内。
以下示例生成 CS0652:
// CS0652.cs
// compile with: /W:2
public class Class1
{
private static byte i = 0;
public static void Main()
{
short j = 256;
if (i == 256) // CS0652, 256 is out of range for byte
i = 0;
}
}