06.42 Using Code Snippets

DEFAULT

Ctrl+K, Ctrl+X

VISUAL BASIC 6

Ctrl+K, Ctrl+X

VISUAL C# 2005

Ctrl+K, Ctrl+X; Ctrl+K, X

VISUAL C++ 2

[no shortcut]

VISUAL C++ 6

Ctrl+K, Ctrl+X

VISUAL STUDIO 6

Ctrl+K, Ctrl+X

WINDOWS

Alt,E, I, I

MENU

Edit | IntelliSense | Insert Snippet

COMMAND

Edit.InsertSnippet

VERSIONS

2005, 2008, 2010

LANGUAGES

C#, VB

CODE

vstipEdit0053

I thought it would be a good idea to review how to use snippets. This example uses tags in ASP.NET, but the concepts apply across the board to all snippets.

Let’s say you are in an ASP.NET application and you start to type an anchor tag, as shown in the following illustration.

image with no caption

You press Tab twice to insert a ...

Get Coding Faster: Getting More Productive with Microsoft® Visual Studio® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.