整個程序在.NET Web的應用程序的Web表單:價值分配,從來沒有使用過,但沒有編譯器消息
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string x = "";
string y = String.Empty;
}
}
}
如果我構建應用程序,編譯器強調X,
變量x被分配到,但it's值永遠不會使用
對於Y,我沒有得到任何下劃線。爲什麼不? (VS 2008,NET 3.5的)
[C#編譯器應該給出警告但不是?]的可能的重複(http://stackoverflow.com/questions/2740885/c-sharp-compiler-should-give-warning-but-doesnt) – 2012-02-01 16:28:47