gpt4 book ai didi

.net - 如何更改 "Generate Method Stub"以在 VS 中抛出 NotImplementedException?

转载 作者:行者123 更新时间:2023-12-04 11:33:01 25 4
gpt4 key购买 nike

如何更改默认设置 Generate Method Stub Visaul Studio 中的行为以生成带有主体的方法

throw new NotImplementedException();

代替
throw new Exception("The method or operation is not implemented.");

最佳答案

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

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.



您可以通过编辑代码片段文件来更改生成的代码:
C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Refactoring\MethodStub.snippet 并将声明部分更改为以下内容:
        <Declarations>
<Literal Editable="true">
<ID>signature</ID>
<Default>signature</Default>
</Literal>
<Literal>
<ID>Exception</ID>
<Function>SimpleTypeName(global::System.NotImplementedException)</Function>
</Literal>
</Declarations>

关于.net - 如何更改 "Generate Method Stub"以在 VS 中抛出 NotImplementedException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com