컴파일러 경고(수준 3) CS0168

업데이트: 2007년 11월

오류 메시지

'var' 변수가 할당되었지만 그 값은 사용되지 않았습니다.
The variable 'var' is assigned but its value is never used

선언한 변수를 사용하지 않는 경우 컴파일러에서 경고합니다.

다음 샘플에서는 CS0168 오류가 발생하는 경우를 보여 줍니다.

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