Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 3) CS0168
Collapse the table of content
Expand the table of content

Compiler Warning (level 3) CS0168

The variable 'var' is assigned but its value is never used

The compiler warns when a variable is declared but not used.

The following sample generates two CS0168 warnings:

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

Community Additions

ADD
Show:
© 2015 Microsoft