I created a simple code snippet in c# which add the line
Debug.WriteLine("");
now the next step would be, when you use the snippet, to autocreate
using System.Diagnostic;
is there any way to automatically create the reference? I tried and set the snippets Reference and Import elements this way:
<Snippet>
<References>
<Reference>
<Assembly>System.dll</Assembly>
</Reference>
</References>
<Imports>
<Import>
<Namespace>System.Diagnostic</Namespace>
</Import>
</Imports>
.
.
.
</Snippet>
but it doesn't work
To create or edit your own snippets, select User Snippets under File > Preferences (Code > Preferences on macOS), and then select the language (by language identifier) for which the snippets should appear, or the New Global Snippets file option if they should appear for all languages.
On the menu bar, choose Edit > IntelliSense > Insert Snippet. From the right-click or context menu in the code editor, choose Snippet > Insert Snippet.
Or, instead of using the Code Snippet Picker, use the short cut by typing “prop” in the code window and then press the Tab key. (You may need to press the Tab key twice if the auto list members drop down is open.) The following code is automatically inserted into the code window.
Unfortunately, Import
only works for VB projects. It is explained on MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With