Skip to content

Instantly share code, notes, and snippets.

@chrisg32
Last active November 4, 2017 05:58
Show Gist options
  • Save chrisg32/680079b90ac159e09b7b6ea2aef1c893 to your computer and use it in GitHub Desktop.
Save chrisg32/680079b90ac159e09b7b6ea2aef1c893 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Prism Property with backing field.</Title>
<Shortcut>prp</Shortcut>
<Author></Author>
<Description>Define a property with backing field</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Replace with the property type</ToolTip>
<Default>string</Default>
</Literal>
<Literal>
<ID>PropertyName</ID>
<ToolTip>Replace with the property name</ToolTip>
<Default>PropertyName</Default>
</Literal>
<Literal>
<ID>fieldName</ID>
<ToolTip>Replace with the field name</ToolTip>
<Default>fieldName</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[private $type$ _$fieldName$;
public $type$ $PropertyName$
{
get => _$fieldName$;
set => SetProperty(ref _$fieldName$, value);
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment