Adding a PRISMPROP snippet to VS C#

This sets up visual studio to add a snippet that will put in a prism style property really quickly and easily and help set this up fast!

FOLDER:

Documents\Visual Studio xxxx\Code Snippets\Visual C#\My Code Snippets\

FILE: prismprop.snippet

XML:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<CodeSnippetsĀ  xmlns=”http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet”>
<CodeSnippet Format=”1.0.0″>
<Header>
<Title>prismprop</Title>
<Shortcut>prismprop</Shortcut>
<Description>Code snippet for property and backing field</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>Prop</Default>
</Literal>
<Literal>
<ID>field</ID>
<ToolTip>The variable backing this property</ToolTip>
<Default>_myVar</Default>
</Literal>
</Declarations>
<Code Language=”csharp”><![CDATA[private $type$ $field$;

public $type$ $property$
{
get { return $field$;}
set { SetProperty<$type$>(ref $field$, value);}
}
$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

 

Leave a Reply

Your email address will not be published. Required fields are marked *