Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>interesting scenario starts when you would like to create surround snippet with $selected$ twice. for instance to create CheckArgumentForNull snippet to check argument for null and in case of null raise ArgumentNullException with parameter name. Only later got replaced.</p> <p>Any ideas? Of course we can use expansion only snippet and type argument name by ourselves.</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;SnippetTypes&gt; &lt;SnippetType&gt;Expansion&lt;/SnippetType&gt; &lt;SnippetType&gt;SurroundsWith&lt;/SnippetType&gt; &lt;/SnippetTypes&gt; &lt;Title&gt;notnull&lt;/Title&gt; &lt;Author&gt;Viiar Consulting&lt;/Author&gt; &lt;Description&gt;Code snippet for checking whether is argument null&lt;/Description&gt; &lt;HelpUrl&gt; &lt;/HelpUrl&gt; &lt;Shortcut&gt;notnull&lt;/Shortcut&gt; &lt;/Header&gt; &lt;Snippet&gt; &lt;Imports&gt; &lt;Import&gt; &lt;Namespace&gt;System&lt;/Namespace&gt; &lt;/Import&gt; &lt;/Imports&gt; &lt;Declarations&gt; &lt;Literal Editable="true"&gt; &lt;ID&gt;argument&lt;/ID&gt; &lt;ToolTip&gt; &lt;/ToolTip&gt; &lt;Default&gt;argument&lt;/Default&gt; &lt;Function&gt; &lt;/Function&gt; &lt;/Literal&gt; &lt;/Declarations&gt; &lt;Code Language="csharp"&gt;&lt;![CDATA[if ($selected$ == null) { throw new ArgumentNullException("$selected$"); } $end$]]&gt;&lt;/Code&gt; &lt;/Snippet&gt; &lt;/CodeSnippet&gt; &lt;/CodeSnippets&gt; </code></pre>
 

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