如何更改"生成方法存根"抛出NotImplementedException在VS? [英] How to change "Generate Method Stub" to throw NotImplementedException in VS?

查看:304
本文介绍了如何更改"生成方法存根"抛出NotImplementedException在VS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改默认生成方法存根在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 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>

这篇关于如何更改&QUOT;生成方法存根&QUOT;抛出NotImplementedException在VS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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