Skip to content

Instantly share code, notes, and snippets.

@rzhw
Forked from andersonimes/gist:2490459
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rzhw/eab74999b4defb3c4437 to your computer and use it in GitHub Desktop.
Save rzhw/eab74999b4defb3c4437 to your computer and use it in GitHub Desktop.
ReactiveUI property code snippet fork
  • Separate public/private literals
  • For RxUI 5
  • No private
  • Single line get/set
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Reactive Property</Title>
<Shortcut>rpr</Shortcut>
<Description>Creates a property that calls RaiseAndSetIfChanged</Description>
<Author>Anderson Imes, Richard Wang</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Type of object in the collection to iterate through</ToolTip>
<Default>var</Default>
</Literal>
<Literal>
<ID>publicname</ID>
<ToolTip>Public name of the property</ToolTip>
<Default>PublicName</Default>
</Literal>
<Literal>
<ID>privatename</ID>
<ToolTip>Private name of the property</ToolTip>
<Default>_privateName</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[$type$ $privatename$;
public $type$ $publicname$
{
get { return $privatename$; }
set { this.RaiseAndSetIfChanged(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