如何在Visual Studio 2017中更改默认代码片段?

4

在 Visual Studio 2017 中,我该如何更改此代码片段中提供的默认代码?

enter image description here

1个回答

5

Visual Studio 2010 -> 工具 -> 代码段管理器

如有需要,请更改编程语言并查看代码段文件的路径。在VS17中关闭并创建一个新的xml文件以用于新的代码段文件。将其保存为“另存为”Codesnippetfile。 输入图像描述 转到现有代码段文件夹并复制所需部分。

   <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
                <Title>  </Title>
                <Description>  </Description>
                <Author>  </Author>
                <Shortcut>  </Shortcut>
                <SnippetTypes>
                        <SnippetType>   </SnippetType>
                </SnippetTypes>
        </Header>
        <Snippet>
            <Code Language="   ">

            </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

填写剩余部分并保存代码片段文件。 返回到代码片段管理器并导入您的新自定义文件片段文件。 否则,您可以编辑现有的片段文件,并以此方式更改自动插入的代码。

详细的说明。 https://www.telerik.com/blogs/visual-studio-tip-creating-your-own-code-snippets


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接