Sdílet prostřednictvím


Compilerwarnung (Stufe 2) CS0652

Aktualisiert: November 2007

Fehlermeldung

Der Vergleich mit einer ganzzahligen Konstante ist nutzlos. Die Konstante befindet sich außerhalb des Bereichs vom Typ "Typ".
Comparison to integral constant is useless; the constant is outside the range of type 'type'

Der Compiler hat einen Vergleich zwischen einer Konstante und einer Variablen entdeckt, in dem die Konstante außerhalb des Bereichs der Variablen liegt.

Im folgenden Beispiel wird CS0652 generiert:

// 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;
   }
}