Possible Duplicate:
Formatting Literal parameters of a C# code snippet
EDIT: This can be closed. Found an exact duplicate, seems there is no solution. =(
Exact Duplicate: Formatting Literal parameters of a C# code snippet
Is there any way to parse a replacement literal when writing a snippet? I'd like to do something like the following:
<Literal>
<ID>PropertyName</ID>
</Literal>
User replaces PropertyName with 'MyProperty' and the results are such:
private object _myProperty;
public object MyProperty
{get;set;}
Note the capitalization. I need a way to parse the replacement literal and manipulate it. The underscore is trivial, simply a matter of hard coding that in.
Any chance here?
Edit; full snippet:
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>MVVM Public Property</Title>
<Author>Michael Leide</Author>
<Description>Adds a public property with private backing and property changed event support.</Description>
<Shortcut>propvm</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>PropertyType</ID>
<Default>object</Default>
</Literal>
<Literal Editable="true">
<ID>PropertyName</ID>
<Default>PropertyName</Default>
</Literal>
</Declarations>
<Code Language="csharp" Kind="" Delimiter="$">
<![CDATA[
$PropertyType$ _$PropertyName$;
public $PropertyType$ $PropertyName$ {
get {
if (_$PropertyName$ == null)
_$PropertyName$ = new $PropertyType$();
return _$PropertyName$;
} set {
_$PropertyName$ = value;
this.OnPropertyChanged("$PropertyName$");
} }
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>