日期:2014-05-17  浏览次数:20789 次

C#命名规范问题
C#创建windows应用程序时,自动生成的代码中,混杂了的中文变量名,比如:
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.图像ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.文字ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.显示图像ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.旋转图像ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.添加文字ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.删除文字ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

这是自动生成的代码,怎么没有符合Camel命名法,需要更改吗?

------解决方案--------------------
图像ToolStripMenuItem是ToolStripMenuItem的Name. 可以在属性中设置。

ToolStripMenuItem的Name不要使用中文,Text中可以使用中文
------解决方案--------------------
Name自己命名为中中文生成就是那样,名字一般不要用中文!起一个个有意义的英文名字
------解决方案--------------------
你在 ToolStripMenuItem 的属性窗口用把Name改下就可以了
------解决方案--------------------
所以结论就是,你应该使用英文版的Visual Studio。
------解决方案--------------------
自己修改Name