Compiler Warning (level 3) CS0168

The variable 'var' is declared but never used

The compiler issues a level-three warning when you declare a variable, but do not use it.

The following sample generates a CS0168 warning:

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

public class clz
{
    public static void Main() {
        clx a; // CS0168, the variable 'a' is declared but never used
        // try the following line instead
        // clx a = new clx();  // this does not generate a warning because the clx constructor must execute.
    }
}