zoukankan      html  css  js  c++  java
  • 编写VS的Snippet

    参考:https://www.cnblogs.com/actberw/archive/2010/04/09/1708395.html(vs中的code snippet技术)

    步骤1:写代码

    <?xml version ="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
    <Header>
    <Title>Property Of ViewModel</Title>
    <Shortcut>vmp</Shortcut>
    <Description>Property Of ViewModel</Description>
    <Author>soeasy</Author>
    </Header>
    <Snippet>
    <Declarations>
    <Literal>
    <ID>DataType</ID>
    <ToolTip>data type of the property</ToolTip>
    <Default>string</Default>
    </Literal>
    <Literal>
    <ID>PropertyName</ID>
    <ToolTip>property name</ToolTip>
    <Default>Prop1</Default>
    </Literal>
    </Declarations>
    <Code Language="CSharp">
    <![CDATA[
    #region $PropertyName$
    $DataType$ _$PropertyName$;
    public $DataType$ $PropertyName$
    {
    get{
    return _$PropertyName$;
    }
    set{
    SetProperty(ref _$PropertyName$,value);
    }
    }
    #endregion
    $end$
    }]]>
    </Code>
    </Snippet>
    </CodeSnippet>
    </CodeSnippets>

    步骤2:存成 soeasy.snippet

    步骤3:vs>工具>代码片断管理器,导入,选择 My Code Snippet

    文件会存放在 C:UserscqsirDocumentsVisual Studio 2017Code SnippetsVisual C#My Code Snippets

    疑问:不懂为什么,在代码片断管理器里,选中My Code Snippet时,没有显示预览。但是实际上这个snippet是可用的。

  • 相关阅读:
    基本运算符
    格式化输出
    Python与用户的交互
    数据类型
    变量
    正则表达式
    vuex方法
    vue的webpack打包步骤
    浮动问题
    媒体查询技术
  • 原文地址:https://www.cnblogs.com/erentec/p/11064617.html
Copyright © 2011-2022 走看看