Code Snippets in Visual Studio 2005
page 5 of 7
by Bilal Haidar
Feedback
Average Rating: 
Views (Total / Last 10 Days): 35444/ 160

How to Use a Built-In Code Snippet

In this section you will see how to use a ready-made code snippet. I will assume you are currently working with an open web application in Visual Studio 2005.

Create a new ASP.NET page, and then flip to the code view so that you will be able to add a code snippet.

Click on Tools, then Code Snippet Manager; you will be faced by the following figure

 

I have selected the prop code snippet included inside the Visual C# package. You can also select any other code snippet belonging to Visual C# or Visual Basic.

In the location section, you can see the location of the code snippet which is the same as mentioned in one of the sections in the article. The left pane shows the Header section of the prop code snippet.

You select a code snippet and press OK. You then see the code snippets code emitted on the page where you are adding the code snippet as follows:

private int myVar;

public int MyProperty

{

get { return myVar;}

set { myVar = value;}

}

The words highlighted by green are the replicable values defined inside the Declarations section of the code-snippet. As you can see, they have taken their default values as defined. Now, the developer should either change the default values to meet his/her needs or keep them the same.

 

 


View Entire Article

User Comments

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

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

http://bhaidar.net/cs/forums/10/ShowForum.aspx

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






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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-09 3:51:25 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search