Created
September 16, 2012 04:06
-
-
Save bjcull/3730960 to your computer and use it in GitHub Desktop.
Property with NotifyOfPropertyChange Code Snippet. To be used with the Caliburn.Mircro library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets | |
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>Property with Notify Snippet</Title> | |
<Author>Ben Cull - http://benjii.me</Author> | |
<Description>Inserts a full property with a NotifyOfPropertyChange statement as well. To be used with the Caliburn.Mircro library.</Description> | |
<Shortcut>propnfy</Shortcut> | |
</Header> | |
<Snippet> | |
<Code Language="CSharp"> | |
<![CDATA[private $type$ $privateVar$; | |
public $type$ $publicVar$ | |
{ | |
get { return $privateVar$; } | |
set | |
{ | |
if ($privateVar$ != value) | |
{ | |
$privateVar$ = value; | |
NotifyOfPropertyChange(() => $publicVar$); | |
} | |
} | |
}]]> | |
</Code> | |
<Declarations> | |
<Literal> | |
<ID>privateVar</ID> | |
<ToolTip>Replace with the private variable name</ToolTip> | |
<Default>_myVar</Default> | |
</Literal> | |
<Literal> | |
<ID>publicVar</ID> | |
<ToolTip>Replace with the public variable name</ToolTip> | |
<Default>MyVar</Default> | |
</Literal> | |
<Object> | |
<ID>type</ID> | |
<Type>System.Type</Type> | |
<ToolTip>Replace with the variable type</ToolTip> | |
<Default>Type</Default> | |
</Object> | |
</Declarations> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment