Skip to content

Instantly share code, notes, and snippets.

@Juansero29
Created January 29, 2021 16:21
Show Gist options
  • Save Juansero29/3b92ab92bcfbe3dc2963b99d84a913f8 to your computer and use it in GitHub Desktop.
Save Juansero29/3b92ab92bcfbe3dc2963b99d84a913f8 to your computer and use it in GitHub Desktop.
Code snippet for a property which implements "PropertyChanged" with a private field.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>FullPropertyChanged</Title>
<Author>Juan R. (Juansero29)</Author>
<Description>
Code snippet for a property which implements "PropertyChanged" with a private field.
</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>obsproperty</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>PropertyName</ID>
<ToolTip>Enter the property name</ToolTip>
<Default>PropertyName</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>PropertyType</ID>
<ToolTip>Enter the property type</ToolTip>
<Default>object</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>Commentary</ID>
<ToolTip>Enter the commentary for your new property</ToolTip>
<Default>Documentation commentary</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
private $PropertyType$ _$PropertyName$;
/// <summary>
/// $Commentary$
/// </summary>
public $PropertyType$ $PropertyName$
{
get => _$PropertyName$;
set => SetValue(ref _$PropertyName$, value);
}
$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment