生成方法存根片段:更改签名,使访问级别公开(Generate method stub snippet

2019-11-01 20:02发布

默认情况下,“提取方法......” 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>
文章来源: Generate method stub snippet: Alter signature to make access level public