Last active
December 1, 2024 18:58
-
-
Save tomeko/60cd46afc130f2bac54cc2b8c5041d29 to your computer and use it in GitHub Desktop.
VS C# Snippets
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<Header> | |
<Title>INotify Property Changed Method</Title> | |
<Author>tomeko</Author> | |
<Shortcut>inotify</Shortcut> | |
<Description>NotifyPropertyChanged method and binds to the event handler</Description> | |
<SnippetTypes> | |
<SnippetType>SurroundsWith</SnippetType> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Code Language="CSharp"> | |
<![CDATA[ | |
public new event PropertyChangedEventHandler? PropertyChanged; | |
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } | |
]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<Header> | |
<Title>Notifiable Property</Title> | |
<Author>tomeko</Author> | |
<Shortcut>iprop</Shortcut> | |
<Description>Property Changed</Description> | |
<SnippetTypes> | |
<SnippetType>SurroundsWith</SnippetType> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>Type</ID> | |
<Default>string</Default> | |
</Literal> | |
<Literal> | |
<ID>Property</ID> | |
<Default>PlaceHolder</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="CSharp"> | |
<![CDATA[private $Type$ _$Property$; | |
public $Type$ $Property$ { get { return _$Property$; } set { _$Property$ = value; OnPropertyChanged(); } }]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment