C# Code Snippets Library

If you didn’t happen to notice it in your Visual Studio Start page RSS feed, this is very cool. They have put out a very comprehensive Code Snippets library for C#, available here:


When I teach our Master Class or Advanced Master Class at IDesign, I often get the question of why Visual Basic has a ton of code snippets and why C# only has a couple dozen. I always feel like I am apologizing for the C# team or it is tempting to make a joke at the VB guys’s expense and say they need them more, which I really don’t believe but is usually got for a laugh (or a few death threats from the VB guys). :)

The fact is we C# guys need them just as bad and should use Code Snippets and other forms of Code Generation such as CodeRush and CodeSmith to the max. Resources like www.gotcodesnippets.com help a lot for not always needing to create one from scratch for every specialized situation you find yourself repeating, but this library gets us even closer with somewhat “out of the box” capabilities.

It includes all kinds of code snippets from collections, to data access to creating data types, cryptography, security, and Windows Forms common needs. These can not only help you avoid writing repetitive code over and over, they give you completed code samples for a lot of situations where you may not have ever written that kind of code before.

Thanks to whoever created this at Microsoft!