Thursday, December 13, 2007

Code Snippets - Get the most out of them

Microsoft finally decided to help us remember some code using the code snippets, that was a new technique since Visual Studio 2005. Visual Studio 2005 came up with some built in code snippets too that I personally didn't find them as much useful as expected. However, later in October 2006, they produced a very nice and vast set of C# code snippets that you can download to integrate those already installed with Visual Studio 2005.
You can download it from this link: http://go.microsoft.com/fwlink/?linkid=57395&clcid=0x409

As you can see below, these snippets have a wide range of functionality that we need in our daily programming activities. You no longer have to know how to Read Data from a Serial port or even compute the hashcode of a password. It's really a great one from Microsoft.

How to Add them?

  1. Well, first of all install the msi file that you downloaded from the URL above
  2. From the Visual Studio menu, choose Tools > Code Snippets Manager.


  3. Press the Add button from the dialog box that will appear


  4. When installing the code snippets package, it will copy all the snippets to My Documents\MSDN\Visual C# 2005 Code Snippets.
    so add this URL in the Browse dialog and press open.


Here you are, and you are done. Right click, Insert Snippet, and you will find the new Visual C# code Snippets appear.


Enjoy and Happy Programming ;)

1 comment: