共用方式為


編譯器警告 (層級 3) CS0168

更新:2007 年 11 月

錯誤訊息

已指派變數 'var',但從未使用其值

當變數已宣告但未使用時,編譯器便會發出警告。

下列範例會產生兩個 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();
   }
}