开发者

Change the Implement Interface template

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 Ch开发者_高级运维anging 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜