Friday, December 23, 2011

Inserting Code Snippets in Visual Studio 2010

Visual Studio's code snippets are a really nice utility that can help you write your code faster by automatically inserting various common code constructs like control flow constructs,  LINQ queries or interfaces.

You can insert a code snippet in three ways:
  1. By pressing CTRL+K followed by CTRL+X
  2. By right-clicking at the position where you want your code snippet inserted and choosing the option "Insert Code Snippet"
  3. By going to the "Edit" menu, choosing the "Intellisense" option and then "Insert Code Snippet" 
Inserting a code snippet using method 2
Inserting a code snippet using method 3
In practice, you will observe that the fastest method for inserting is method 1 (especially if you write C# code).

After you started the insertion you simply navigate through the menu using TAB until you find the snippet
you want.

No comments:

Post a Comment

Got a question regarding something in the article? Leave me a comment and I will get back at you as soon as I can!

Related Posts Plugin for WordPress, Blogger...
Recommended Post Slide Out For Blogger