Advertisement
Guest User

propnotif

a guest
May 8th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.35 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <Header>
  4.     <Title>propnotif</Title>
  5.     <Author>Solal Pirelli</Author>
  6.     <Shortcut>propnotif</Shortcut>
  7.     <Description>Code snippet for property and backing field. The setter uses FirePropertyChanged</Description>
  8.     <SnippetTypes>
  9.       <SnippetType>Expansion</SnippetType>
  10.     </SnippetTypes>
  11.   </Header>
  12.   <Snippet>
  13.     <Declarations>
  14.       <Literal>
  15.         <ID>type</ID>
  16.         <ToolTip>Property type</ToolTip>
  17.         <Default>int</Default>
  18.       </Literal>
  19.       <Literal>
  20.         <ID>property</ID>
  21.         <ToolTip>Property name</ToolTip>
  22.         <Default>MyProperty</Default>
  23.       </Literal>
  24.       <Literal>
  25.         <ID>field</ID>
  26.         <ToolTip>The variable backing this property</ToolTip>
  27.         <Default>myVar</Default>
  28.       </Literal>
  29.     </Declarations>
  30.     <Code Language="CSharp">
  31.       <![CDATA[
  32.      private $type$ $field$;
  33.      public $type$ $property$
  34.      {
  35.          get { return this.$field$; }
  36.          set
  37.          {
  38.              if( this.$field$ != value )
  39.              {
  40.                  this.$field$ = value;
  41.                  this.FirePropertyChanged("$property$");
  42.              }
  43.          }
  44.      }
  45.      ]]>
  46.     </Code>
  47.   </Snippet>
  48. </CodeSnippet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement