0
我已经继承了.NET 1.0中写入的ASP.NET/C#项目。我开始使用.NET 2.0进行编程,因此一些过时的概念是陌生的。我注意到,该网页的80%,有下面的代码片段或类似的东西:组件设计器在后面的代码中生成代码
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
connSQL = new System.Data.SqlClient.SqlConnection();
connSQL.ConnectionString = Inventory.Properties.Settings.Default.connectionString;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
虽然这个区域在页面加载过程中撞,注释掉它具有在网页上没有明显的影响。我可以猜测,如果connSQL对象被使用并且没有在其他地方初始化,那么问题就会出现,但事实并非如此。所以,我的问题是这个设计器生成的代码来自哪里?我从来没有看到它背后的代码。这是另一个.net 1.0的东西吗?