更改实现接口模板 [英] Change the Implement Interface template
问题描述
在Visual Studio 2010中,是有可能改变实现接口时使用的默认模板?
我想特性的实现从
公众诠释myProperty的
{
得到
{
抛出新NotImplementedException();
}
组
{
抛出新NotImplementedException();
}
}
到
公众诠释myProperty的{搞定;组; }
修改
所以我试图编辑PropertyStub.snippet但无济于事,它并没有改变什么......
我发现这个问题的更改属性存根接口重构它说,ReSharper的是唯一的出路。
这个工作,例如,使我做似乎没有任何效果。
是的,这是可以改变的改变此模板。 C#的IDE使用的模板,为广大它的代码生成和IDE的。您可以更新这些模板来控制代码生成过程。它们位于以下目录
C:\Program文件(x86)\Microsoft的Visual Studio 10.0\VC#\ Snippets\1033\Refactoring
块引用>
注:(X86)部分将在32位机器缺席。
对于要修改
PropertyStub.snippet
文件这一特殊情况。In Visual Studio 2010, is it possible to change the default template used when implementing an interface?
I would like to change the implementation of properties from
public int MyProperty { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
to
public int MyProperty { get; set; }
Edit
so i tried to Edit PropertyStub.snippet but to no avail, it didn't change anything...
I found this question Changing property stubs for interface refactoring which says that ReSharper is the only way.
Anyone able to make this work, with example, cause the change i made did not seem to have any effects
解决方案Yes, it is possible to change this template. The C# IDE uses templates for the majority of it's code generation and the IDE. You can update these templates to control the code generation process. They are located in the following directory
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Refactoring
Note: The " (X86)" portion will be absent on 32 bit machines.
For this particular situation you want to change the
PropertyStub.snippet
file.这篇关于更改实现接口模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!