Write a Snippet VS

Reference: https://www.cnblogs.com/actberw/archive/2010/04/09/1708395.html (vs code snippet in the art)

 

Step 1: Write the code

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

Step 2: deposit into soeasy.snippet

Step 3: vs> Tools> snippet manager, import, select My Code Snippet

Files will be stored in C: \ Users \ cqsir \ Documents \ Visual Studio 2017 \ Code Snippets \ Visual C # \ My Code Snippets

Question: When do not understand why, in the code snippet manager, select My Code Snippet, did not show a preview. But in fact this snippet is available.

Reproduced in: https: //www.cnblogs.com/erentec/p/11064617.html

Guess you like

Origin blog.csdn.net/weixin_34357267/article/details/93691124