如何更改 Visual Studio 2017 中的默认代码片段? [英] How to change the a default code snippet in Visual Studio 2017?

查看:53
本文介绍了如何更改 Visual Studio 2017 中的默认代码片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Given this code snippet, how can I change the default code provided in this snippet, in Visual Studio 2017?

推荐答案

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

Visual Studio 2010 -> Tools -> Code Snippet Manager

如果需要,更改编程语言并查看代码片段文件的路径.关闭并在 VS17 中为新的片段文件创建一个新的 xml 文件.使用 "Save File as" 将其另存为 Codesnippetfile.转到现有片段文件的文件夹并复制所需部分.

Change if needed the programming language and look ah the path of the snippet files. Close and create in VS17 a new xml file for a new snippet file. Save this as a Codesnippetfile with "Save File as" . Go to the Folder of the existing snippetfiles and copy the needed part.

   <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>

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

Fill the rest and save the codesnippet file. Go back to the Code Snippet Manager and import your new custom file snippet file. Otherwise you can edit a existing snippet file and change on this way the automatic insertet code.

有关详细说明.https://www.telerik.com/博客/visual-studio-tip-creating-your-own-code-snippets

这篇关于如何更改 Visual Studio 2017 中的默认代码片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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