且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-14 21:01:27

来自的 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 Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Refactoring\MethodStub.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>