我正在调试一些代码,并注意到一些自动生成的方法和对象。
在这些代码的顶部,我发现以下评论:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------,,你怎么知道是什么产生了这些代码?我的好奇心在这个问题上占了上风,这就是我为什么要问的原因。我在谷歌搜索了部分评论,但没有发现任何具体的内容。
发布于 2009-01-29 17:19:54
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FirstWeb
{
public partial class _Default
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
}
} 您不会更改此自动生成的C#文件。当您不断向页面添加ASP.NET控件时,该文件将随着附加声明的增加而增长。在较早版本的C# (2.0版本之前)和Visual (2005年版本之前)中,这段代码也在常规的Default.aspx.cs文件中。
通过在C#中引入部分类,属于同一类的代码可以跨多个文件拆分。在这里您可以看到“partial _Default”,它用于保存Visual 生成的代码。您还将在Default.aspx.cs文件中看到相同的类签名(您使用它来编写您自己的自定义代码)。
因此,开发人员(您)和设计器(Visual )可以相互独立地工作,而不相互影响。
这是取自C#中的第一个网络程序(Web )的
发布于 2009-01-29 13:53:11
这将完全取决于代码是什么。
您大概知道您正在调试的类--不管它是ORM的一部分,还是web服务生成的代理的一部分等等。这是关键的信息。
发布于 2009-01-29 13:58:47
这也可以是由.Designer.cs生成的ResXFileCodeGenerator文件,它为.resx文件生成强类型的包装器。
https://stackoverflow.com/questions/491646
复制相似问题