BizTalk Utilities CV ,   Jobs ,   Code library
Go to the front page to continue learning about XML or select below:


ReBlogger Contents

Previous posts in XML

Page 15366 of 21350

Code Snippets in Visual Web Developer and VS 2005

Blogger : ScottGus Blog
All posts : All posts by ScottGus Blog
Category : XML
Blogged date : 2006 Jan 27

One of the nice new features of Visual Web Developer (which is free) and VS 2005 is the new "Code Snippet Support" that has been added.  This handy feature allows you to quickly find and use code-libraries of common patterns (examples: get/set property definitions, data access code, file IO, exception handling blocks, etc).

To try it out, just right-click within a code file to bring up a context menu:

Select "Insert Snippet" from the context menu, and then choose the category of snippet you want to use (for example: "File System"):

And then the code-nugget to inject:

You'll then have the code added at that location in the editor.  Common variable values will be automatically highlighted for you, with the cursor set on the first value.  You can replace the values with your own, and then tab to automatically jump to fill in the next value (no need to use the mouse or arrow keys):

What makes code snippets really cool is that you can easily create and define your own.  So over-time you can build up your own library of common patterns that you use, and add efficiency to your daily tasks (for example: do you always write data code in a certain way, or insert objects into the ASP.NET cache using a specific pattern, or validate security, etc.)  These snippets are stored within XML files on disk, and can be easily shared across a dev team (or friends).

Here are a couple of articles and links I found on the web that go into how to build and use your own snippets:

Hope this helps,



Read comments or post a reply to : Code Snippets in Visual Web Developer and VS 2005
Page 15366 of 21350

Newest posts

    Email TopXML