Last active
August 31, 2023 06:46
-
-
Save osyyyS/f2eaaea1941a4e92e311c7df0ecaf6f4 to your computer and use it in GitHub Desktop.
Creates an observable property with a backing field.
This file contains 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
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>Observableproperty with Backing Field</Title> | |
<Description>Creates a observable property with a backing field.</Description> | |
<Shortcut>bindableProp</Shortcut> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>Type</ID> | |
<ToolTip>Property type</ToolTip> | |
<Default>bool</Default> | |
</Literal> | |
<Literal> | |
<ID>PropertyName</ID> | |
<ToolTip>Property name</ToolTip> | |
<Default>IsBusy</Default> | |
</Literal> | |
<Literal> | |
<ID>FieldName</ID> | |
<ToolTip>Backing field name</ToolTip> | |
<Default>isBusy</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"> | |
<![CDATA[public $Type$ $PropertyName$ { get => $FieldName$; set => SetProperty(ref $FieldName$, value); } | |
private $Type$ $FieldName$;]]></Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment