如何更改"生成方法存根"抛出NotImplementedException在VS?存根、抛出、如何更改、方法

由网友(挽噬)分享简介:如何更改默认生成方法存根在VISAUL工作室行为生成方法体How can I change default Generate Method Stub behavior in Visaul Studio to generate method with bodythrow new NotImplementedExcep...

如何更改默认生成方法存根在VISAUL工作室行为生成方法体

How can I change default Generate Method Stub behavior in Visaul Studio to generate method with body

throw new NotImplementedException();

而不是


推荐答案

来自的 http://blogs.msdn.com/ansonh/archive/2005/12/08/501763.aspx

Visual Studio 2005的支持针对1.0版的紧凑型框架。为了保持所述紧凑架构的尺寸小,它不包括所有存在于桌面框架同一类型。一个不包括在类型是NotImplementedException。

Visual Studio 2005 supports targeting the 1.0 version of the compact framework. In order to keep the size of the compact framework small, it does not include all of the same types that exist in the desktop framework. One of the types that is not included is NotImplementedException.

您可以通过编辑code段文件更改生成code: C: Program Files文件微软的Visual Studio 8 VC#片段 1033 重构 MethodStub.snippet 并变更声明节为以下内容:

You can change the generated code by editing the code snippet file: C:Program FilesMicrosoft Visual Studio 8VC#Snippets1033RefactoringMethodStub.snippet and changing the Declarations section to the following:

        <Declarations>
            <Literal Editable="true">
                <ID>signature</ID>
                <Default>signature</Default>
            </Literal>
            <Literal>
                <ID>Exception</ID>
                <Function>SimpleTypeName(global::System.NotImplementedException)</Function>
            </Literal>
        </Declarations>
阅读全文

相关推荐

最新文章