Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:

Want more? Here are some additional resources on this topic:

Visual Studio 
Code Snippet Picker 

The Visual Studio 2005 Code Editor provides a Code Snippet Picker that allows you, in a few mouse clicks, to insert ready-made blocks of code into the active document.

The procedure to display the Code Snippet Picker varies according to the language you are using.

  • Visual Basic - Right-click at the desired location in the Code Editor to display the Shortcut menu, and select Insert Snippet.

  • Visual C# and Visual J# - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

  • Visual C++ - The Code Snippet Picker is not available.

  • XML - Right-click at the desired location in the Code Editor to display the Shortcut menu, and click Insert Snippet or Surround With.

In most Visual Studio development languages, you can use the Code Snippets Manager to add folders to the Folder List that the Code Snippet Picker scans for XML snippet files. You can also search for additional snippets online for use with Visual Studio. For more information, see How to: Search for Code Snippets Online.

Item Name

An editable text field that displays the name of the item selected in the Item List. To perform an incremental search for the item you want, begin typing its name in this field. Continue adding letters until the desired item is selected in the Item List.

Item List

A list of code snippets available for insertion, or a list of folders containing code snippets. To insert a snippet or expand a folder, select the item you want and press Enter.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
How this is one of the MOST important topics      Dan Wygant ... Debashish   |   Edit   |   Show History

I'm very happy I could use SNIPPET techniques to enable my dev team to use the exact same format for properties:

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
 <CodeSnippet Format="1.0.0">
  <Header>
   <Title>aprop str</Title>
   <Shortcut>aprop str</Shortcut>
   <Description>Code snippet for string property and backing field</Description>
   <Author>Dan Wygant, Trideum</Author>
   <SnippetTypes>
    <SnippetType>Expansion</SnippetType>
   </SnippetTypes>
  </Header>
  <Snippet>
   <Declarations>
    <Literal>
     <ID>field</ID>
     <ToolTip>The variable backing this property</ToolTip>
     <Default>myVar</Default>
    </Literal>
   </Declarations>
   <Code Language="csharp"><![CDATA[private string _$field$ = "";

 /// <summary>
 /// Gets or sets the $field$ property
 /// </summary>
 public string $field$
 {
  get
  {
   return _$field$;
  }
  set
  {
   _$field$ = value;
  }
 }
 $end$]]>
   </Code>
  </Snippet>
 </CodeSnippet>
</CodeSnippets>

http://Dan.Wygant.org

MVP WinServer03' Customer Experience

Founding Father http://HUNTUG.org http://VSdotNetUG.org http://HowToVS.Net

Membership Manager for USer Groups in Al/Ms/La http://INETA.org

Founding Father (previous Board member) http://Culminis.org

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker