Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Comparison to integral constant is useless; the constant is outside the range of type 'type'
The compiler detected a comparison between a constant and a variable where the constant is out of the range of the variable.
The following sample generates 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;
}
}