How to lower case a Visual Studio Code Snippet variable?

.net, c#, code-snippets, visual-studio

Solution

It is not possible to change literals in a Code Snippets. There are some functions available:

GenerateSwitchCases - Generates a switch statement and a set of case statements for the members of the enumeration specified by the EnumerationLiteral parameter. The EnumerationLiteral parameter must be either a reference to an enumeration literal or an enumeration type.

ClassName - Returns the name of the class that contains the inserted snippet.

SimpleTypeName - Reduces the TypeName parameter to its simplest form in the context in which the snippet was invoked.

But they cannot modify literals.

Source: http://msdn.microsoft.com/en-us/library/ms242312(v=vs.110).aspx

Problem

I've build some snippets to generate a fields for a setting class. I'm now using 2 variables - `$setting$` and `$Setting$` - to generate names for the property and the backing field. I like to use a single variable, because the only difference is that the backing field is always a lower-cased version. Current code: ``` string $setting$; /// <summary> /// Gets the $bigComment$. /// </summary> /// <value>The $smallComment$.</value> public string $Setting$ { get { if (String.IsNullOrEmpty($setting$)) { $setting$ = CFW.Common.Configuration.GetAppSetting("$Setting$", $defaultValue$); } return $setting$; } } ``` Is this possible?

Original source

Related problems