Skip to content

Instantly share code, notes, and snippets.

@moraismateus
Last active May 13, 2022 05:23
Show Gist options
  • Save moraismateus/53ba7ce186867ee8f23b73d0e26d6000 to your computer and use it in GitHub Desktop.
Save moraismateus/53ba7ce186867ee8f23b73d0e26d6000 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>Notifiable Property</Title>
<Description>C# property that implements SetField(), it needs a similar code I have in my Base ViewModel @ https://gist.github.com/moraismateus/d4f955ea601d4214052358fbfe4763d3</Description>
<Author>Mateus Morais</Author>
<Shortcut>nprop</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>PublicName</ID>
<ToolTip>Property Public Name</ToolTip>
<Default>PublicName</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>PrivateName</ID>
<ToolTip>Property Private Name</ToolTip>
<Default>PrivateName</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>PropertyType</ID>
<ToolTip>PropertyType</ToolTip>
<Default>PropertyType</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[
private $PropertyType$ _$PrivateName$;
public $PropertyType$ $PublicName$
{
get => _$PrivateName$;
set => SetField(ref _$PrivateName$, value);
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment