When compiling the following program in VS2010, VS2008 or MonoDevelop on Windows, I get warning CS0219, "The variable 'y' is assigned but its value is never used".
namespace Problem
{
public class Program
{
private static void Main(string[] args)
{
object x = new object();
int y = 0;
}
}
}
Why is there no warning for x
when compiling in Visual Studio?
Interestingly, I do get CS0219 warnings for x
and y
when compiling in MonoDevelop on Mac OS X.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…