编译器警告(等级 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();
}
}