Freigeben über


Compilerwarnung (Stufe 3) CS0168

Aktualisiert: November 2007

Fehlermeldung

Die Variable "Var" ist zugewiesen, ihr Wert wird aber nie verwendet.
The variable 'var' is assigned but its value is never used

Wenn eine Variable deklariert ist, jedoch nie verwendet wird, gibt der Compiler eine Warnung aus.

Im folgenden Beispiel werden zwei CS0168-Warnungen generiert:

// CS0168.cs
// compile with: /W:3
public class clx
{
   public int i;
}

public class clz
{
   public static void Main()
   {
      int j = 0;   // CS0168, uncomment the following line
      // j++;
      clx a;       // CS0168, try the following line instead
      // clx a = new clx();
   }
}