如何更改默认的Visual Studio C#新类文件模板? [英] How can I change the default Visual Studio C# new class file template?
问题描述
是否可以在Visual Studio 2010中更改模板,以便将类定义更改为:
Is it possible to change the template in Visual Studio 2010 so that the class definition is changed from:
class Class1
{
}
收件人:
public class Class1
{
}
通过上下文菜单中的添加"->类"创建新类时.
When creating a new class via Add->Class in the context menu.
理想情况下,我还希望能够在一次上下文菜单单击中创建一个类.我复制并粘贴现有的类文件,以避免出现文件对话框.
I would also ideally like to be able to create a class in one context menu click. I copy+paste existing class files to avoid the file dialog.
推荐答案
您可以修改以下文件:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
它包含添加新类时使用的模板.在同一文件夹中,您还具有接口模板: Interface.zip
,以便默认情况下它们是公共的.IIRC必须重新启动VS才能选择更改.
It contains the template used when you add a new class. Inside the same folder you also have the template for interfaces: Interface.zip
so that they are public by default. IIRC a restart of VS is necessary to pick the changes.
这篇关于如何更改默认的Visual Studio C#新类文件模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!