Note that there are some explanatory texts on larger screens.

plurals
  1. POParse Replacement Literal in Visual Studio Snippet
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/164645/formatting-literal-parameters-of-a-c-sharp-code-snippet">Formatting Literal parameters of a C# code snippet</a> </p> </blockquote> <p>EDIT: This can be closed. Found an exact duplicate, seems there is no solution. =(</p> <p>Exact Duplicate: <a href="https://stackoverflow.com/questions/164645/formatting-literal-parameters-of-a-c-sharp-code-snippet">Formatting Literal parameters of a C# code snippet</a></p> <p>Is there any way to parse a replacement literal when writing a snippet? I'd like to do something like the following:</p> <pre><code>&lt;Literal&gt; &lt;ID&gt;PropertyName&lt;/ID&gt; &lt;/Literal&gt; </code></pre> <p>User replaces PropertyName with 'MyProperty' and the results are such:</p> <pre><code>private object _myProperty; public object MyProperty {get;set;} </code></pre> <p>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. </p> <p>Any chance here?</p> <p>Edit; full snippet:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"&gt; &lt;CodeSnippet Format="1.0.0"&gt; &lt;Header&gt; &lt;Title&gt;MVVM Public Property&lt;/Title&gt; &lt;Author&gt;Michael Leide&lt;/Author&gt; &lt;Description&gt;Adds a public property with private backing and property changed event support.&lt;/Description&gt; &lt;Shortcut&gt;propvm&lt;/Shortcut&gt; &lt;/Header&gt; &lt;Snippet&gt; &lt;Declarations&gt; &lt;Literal Editable="true"&gt; &lt;ID&gt;PropertyType&lt;/ID&gt; &lt;Default&gt;object&lt;/Default&gt; &lt;/Literal&gt; &lt;Literal Editable="true"&gt; &lt;ID&gt;PropertyName&lt;/ID&gt; &lt;Default&gt;PropertyName&lt;/Default&gt; &lt;/Literal&gt; &lt;/Declarations&gt; &lt;Code Language="csharp" Kind="" Delimiter="$"&gt; &lt;![CDATA[ $PropertyType$ _$PropertyName$; public $PropertyType$ $PropertyName$ { get { if (_$PropertyName$ == null) _$PropertyName$ = new $PropertyType$(); return _$PropertyName$; } set { _$PropertyName$ = value; this.OnPropertyChanged("$PropertyName$"); } } ]]&gt; &lt;/Code&gt; &lt;/Snippet&gt; &lt;/CodeSnippet&gt; &lt;/CodeSnippets&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload