Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 835 Bytes

cs0168.md

File metadata and controls

35 lines (30 loc) · 835 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Compiler Warning (level 3) CS0168
Compiler Warning (level 3) CS0168
12/21/2016
CS0168
CS0168
6f5b7fe3-1e91-462f-8a73-b931327ab3f5

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.
    }
}