Code Snippets in Visual Studio 2005
page 3 of 7
by Bilal Haidar
Average Rating: 
Views (Total / Last 10 Days): 35086/ 121

Major Parts of a Code Snippet

The code snippet consists of two main parts:

  • Header
  • Snippet


The Header has the following sections:

  • Title
  • Shortcut
  • Description
  • Author
  • SnippetTypes


The Header is the code snippets meta-data which includes the title of the code snippet, a shortcut to access the code snippet, a description explaining what the code snippet does, and other relevant information.

The Snippet has a mandatory section and an optional one:

  • Declarations
  • Code

The required section is the Code section. In this section you define the code emitted by the code snippet. The optional Declarations section is used to define the replaceable values in the code snippet. Replicable values are represented by $value$ in the Code section; they are displayed as green and are configurable by the developer using the code snippet.


Code snippets are language-specific. Visual Studio 2005 ships with a number of ready code snippets for both Visual Basic and C#. You can find all the code snippet files at the following path:

{Drive Letter}:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#


View Entire Article

User Comments

Title: developer   
Name: sunil
Date: 2009-10-27 9:23:04 AM
very nice exmpl
Title: developer   
Name: nanda
Date: 2007-08-06 2:00:31 AM
nice article..
Title: Developer   
Name: Stefan Leoni
Date: 2006-12-13 7:18:51 AM
concise. Excactly what i was looking for.

Title: Re:   
Name: Bilal Haidar
Date: 2006-01-20 3:38:15 PM
You can now, discuss, comment, and ask me questions related to this article at this forum:

Title: Solution Developer   
Name: Mostafa
Date: 2006-01-07 3:05:53 AM
Good Article.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-28 11:21:10 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search