在VB 2010中哪里可以找到自动(系统)生成的代码 [英] where to find auto (system) generated code in vb 2010

查看:46
本文介绍了在VB 2010中哪里可以找到自动(系统)生成的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用datagridview编写代码,并希望查看系统生成的代码.在2005年或更早的版本中很容易找到这样的代码,但是,我无法在VB 2010中找到它.请提供任何线索?
谢谢,

Aman

Hi,
I am writing a code using datagridview and wanted to look at the system generated code. It was easy to find such codes in versions 2005 and earlier, however, I am unable to trace it in the VB 2010. Any clues please??

Thanks,

Aman

推荐答案

您可能看错了方向:自动生成的代码位于同一位置.对于* .resx资源和System.Windows.Forms表单的设计者生成的代码,自动生成的代码位于主资源或表单节点的子节点中.您可以通过查看属性来找到文件系统中的位置,但这应该与父节点之一位于同一目录.

现在,从VS 2005开始,又发现了另一种形式的自动生成的代码-WPF应用程序的代码.这是不同的故事.如果从模板创建WPF应用程序,则会在编译时创建自动生成的代码,但它不是源代码的一部分:而是作为临时代码创建的,仅在编译时创建.您可以在项目目录的"obj"子目录下找到它.我必须说,我不明白它是如何引起任何问题的.如果我不知道这是什么,可以使用文件搜索轻松找到它.我也建议你也这样做.

实际上,查看自动生成的代码以了解其工作原理是一个好主意.在许多情况下,您需要自己编写此类代码.大量使用设计器进行手动重复工作,这经常被软弱的人滥用.真正的开发人员在代码中完成了大部分工作,并在保持良好质量的同时节省了大量开发时间.

—SA
You probably looked in wrong direction: the auto-generated code is in the same location. For *.resx resources and designer-generated code for System.Windows.Forms forms, the auto-generated code is located in the child nodes of the main resource or form nodes. You can find the location in the file system by looking at properties, but this should be the same directory as the one of the parent node.

Now, since VS 2005, one more form of auto-generated code was found — the code for WPF application. This is the different story. If you create the WPF application from template, the auto-generated code is created in compilation, but it is not a part of the source code: it is created as a temporary code, just in compilation. You can find it under the project directory, under the ''obj'' sub-directory. I must say, I don''t understand how it caused any problems. If I don''t know where is what, I can easily find it using file search. I suggest you do it, too.

Actually, this is a good idea to look at auto-generated code to understand how things work. In many situation, you need to write such code by yourself. Extensive use of the designer if for manual repeating work which is often abused by the weak-minded. Real developers do considerable part of this work in code and save a lot of development time while maintaining good quality.

—SA


designer.cs文件包含系统生成的代码.

从2005年开始,部分类允许您将代码拆分为具有相同类名的不同文件-这些代码指示相同的类,但是它们拆分为不同的文件.
The designer.cs file contains code that is system generated.

Since 2005, partial classes allow you to split code across different files with the same class name - these indicate the same class however they are split across different files.


这篇关于在VB 2010中哪里可以找到自动(系统)生成的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆