更改实现接口模板 [英] Change the Implement Interface template

查看:129
本文介绍了更改实现接口模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

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