Brian H. Madsen
Computer says no

Visual Studio 2005 code snippets

February 21st 2007 in 2115

Microsoft released a whole bunch of code snippets and i think it’s gone pretty much unnoticed.

A whole range of them are available in neat categories on the MSDN web site:

Application Code Snippets
For working with Isolated Storage, ClickOnce tasks, Console Applications and Process Management.

Collections and Arrays Code Snippets
For tasks like creating, iterating, locating elements, and sorting collections like arrays and dictionaries.

Connectivity Code Snippets
For checking network status, downloading a file via HTTP, performing serial port operations, sending email and more.

Crystal Reports Code Snippets
For common reporting tasks such as printing a Crystal Report, setting report parameters, and configuring report data access.

Database Code Snippets
For performing a variety of common tasks around ADO.NET data access.

File System Code Snippets
For performing a number of tasks around reading, writing, and managing files.

Math Code Snippets
For calculating monthly payments, depreciation, sines, cosines, and random numbers.

Operating System Code Snippets
A large collection of snippets for Event logging, Message Queues, Process management, registry access, windows services, getting system information and more.

Security Code Snippets
For working with hashes, decrypting, encrypting, and getting a user’s name.

Smart Devices Code Snippets
For performing common tasks on Smart Devices.

Windows Forms Code Snippets
For working with the clipboard, fonts, sounds, GDI drawing, and general Windows Form and control creation.

XML Code Snippets
For reading and writing XML, selecting nodes, performing XSL transforms, and other XML oriented tasks.

For those that doesn’t know what a code snippet is and how it’s used then it’s really very simple.

a code snippet is a piece of code which has been written previously and can be inserted from a snippet library. Most used to use macros to perform operations (i use a Logitech G15 keyboard and have 54 keys bound to a range of macros – yes i know it’s a gaming keyboard..but the G-Keys are handy). Now, for those that i like to re-use at home as well as at work i’ve put into the snippet library and can simply just copy the files onto a usb drive and take them with me to work.

You can bring up the Snippet Manager by pressing CTRL+ K, CTRL+ B (that’s the default so if you’ve changed it you know best which key it is).

The snippet manager basically just indexes/collates your snippets as they aren’t part of Visual Studio but sitting on your local disk as you can see in the “Location” bar above the folders.

“My Code Snippets” doesn’t contain any snippets when you first install Visual Studio but that’s where i’ve stored all of mine.

you can import folders and manage them via the snippet manager.

Anyways, this wasn’t meant to be a snippet tutorial – just a friendly community announcement :)


required - won't be displayed

Your Comment:


I’m in the midst of moving all my stuff from several other hosts onto my new host – and over the years i’ve been using numerous companies, both personally and through work – but none, absolutely none even compares to the service and response time i’ve gotten from Yesterday evening, before going to bed, […]

Previous Entry

We finally got Google Analytics working for our blogs here on MSMVPS.COM and first impression is that it’s great. Eventhough i’m subscribed to Feedburner’s Pro package it simply leaves it in the dust. It is without a doubt the bets stats package i’ve come across that’s free. i’d highly recommend anybody getting an account and […]

Next Entry