Compiler Warning (level 2) CS0652
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;
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: