Skip to content

Instantly share code, notes, and snippets.

@bc3tech
Last active September 29, 2015 15:05
Show Gist options
  • Save bc3tech/6ab654137ec33b66f20f to your computer and use it in GitHub Desktop.
Save bc3tech/6ab654137ec33b66f20f to your computer and use it in GitHub Desktop.
VS 2015 C# 6.0 code snippet for read-only properties
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>property prop propr 6</Keyword>
</Keywords>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>propr</Title>
<Author>bc3tech</Author>
<Description>Code snippet for a read-only property
Language Version: C# 6.0 or higher</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>propr</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>accessor</ID>
<ToolTip>accessor</ToolTip>
<Default>public</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>returnType</ID>
<ToolTip>returnType</ToolTip>
<Default>int</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>propertyName</ID>
<ToolTip>propertyName</ToolTip>
<Default>MyProperty</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp" Delimiter="$" Kind="method decl"><![CDATA[$accessor$ $returnType$ $propertyName$ { get; }]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment