Skip to content

Instantly share code, notes, and snippets.

@andersonimes
Created April 25, 2012 15:09
Show Gist options
  • Save andersonimes/2490459 to your computer and use it in GitHub Desktop.
Save andersonimes/2490459 to your computer and use it in GitHub Desktop.
Property Code Snippet for ReactiveUI
<?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>propr</Shortcut>
<Description>Creates a property that calls RaiseAndSetIfChanged</Description>
<Author>Anderson Imes</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>propname</ID>
<ToolTip>Name of the property</ToolTip>
<Default>Name</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[private $type$ _$propname$;
public $type$ $propname$
{
get
{
return _$propname$;
}
set
{
this.RaiseAndSetIfChanged(x => x.$propname$, value);
}
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment