默认情况下,Visual Studio 的“提取方法...”命令生成具有最低可能访问级别的方法存根,通常是private
. 它的相关代码片段仅引用“签名”,但我该如何编辑此签名?
供参考,内容C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC#\Snippets\1033\Refactoring\MethodStub.snippet
:
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Method Stub - Body</Title>
<Description>Snippet for generating method stub with a body</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Refactoring</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>signature</ID>
<Default>signature</Default>
</Literal>
<Literal>
<ID>Exception</ID>
<Function>SimpleTypeName(global::System.NotImplementedException)</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[$signature$
{
$end$throw new $Exception$();
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>