I decided to use the following style of creating properties (using the support field):
private _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } }
Given that the property name is similar to the name of the support field, I improved the inline prop fragment as follows:
<?xml version="1.0"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>prop</Title> <Author>Frank Rizzo</Author> <Description>Code snippet for property and backing field - changed one (not the original).</Description> <Shortcut>prop</Shortcut> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>type</ID> <ToolTip>Property type</ToolTip> <Default>int</Default> </Literal> <Literal> <ID>property</ID> <ToolTip>Property name</ToolTip> <Default>MyProperty</Default> </Literal> <Literal> <ID>field</ID> <ToolTip>The variable backing this property</ToolTip> <Default>myVar</Default> </Literal> </Declarations> <Code Language="CSharp"><![CDATA[private $type$ _$field$; public $type$ $field$ { get { return _$field$;} set { _$field$ = value;} } $end$ ]]></Code> </Snippet> </CodeSnippet> </CodeSnippets>
This works to some extent, but the cover of the support field and the property name are always the same, where, as in my agreement, the support field is on a camel basis, where, since the property name has pascal.
So my question is this: does the code snippet syntax have a way to change the first letter of the property so that the snippet can fit my agreement?
source share