Local variable with same name as instance variable = unexpected results
问题 ASP.NET 4.0 Webforms project. I have the following in my code-behind. public partial class _Default : System.Web.UI.Page { private string testVar; protected override void OnInit(EventArgs e) { string testVar = "test"; } protected void Page_Load(object sender, EventArgs e) { var whatsTheValue = testVar; } } I'm setting a break point inside each method. When the local variable, testVar , is set in OnInit , if I quick watch the instance variable, it also has the value "test". When I play through