views:

161

answers:

3

Question

I was wondering if anyone knows where I might find C# versions of the VB.NET code snippets built in to Visual Studio (2008)?

What are Code Snippets?

VB.NET has a wide-ranging collection of snippets that cover most of the basic tasks one might want to accomplish, i.e. File I/O, LINQ, DB connectivity, and so on. C# has a much smaller and narrower library, mainly stuff for NetFX 3.0, Refactoring, and something called "other", among one or two other items.

+2  A: 

The code snippets should still work. Tools => Code Snippets Manager..., or the chord:

Ctrl+K, Ctrl+B

For example, prop Tab Tab gives:

public int MyProperty { get; set; }

with ability to step through the pieces to change. The full list is in the manager.

Marc Gravell
Actually more snippets for Visual Basic are provided out of the box than are for C#.
Chris
+1  A: 

Doh! Further searching revealed the following:

http://msdn.microsoft.com/en-gb/vstudio/aa718338.aspx

Visual C#

Task-Based Code Snippets This is a set of task-based code snippets in C# that can help you with programming tasks ranging from working with databases and windows applications to writing mobile device applications and networking programs. Note: Visual Basic versions of these snippets are included in the box.

Looks like this is exactly what I was looking for.

Tom the Junglist
+1  A: 

Two resources that I've used before to get C# code snippets are

Got Code Snippets and Visual Studio 2005 Code Snippets which will give you a collection of over 400 different types of C# code snippets.

If there is a particular VB code snippet that you like you can alway use a tool to translate the code in C# and then create your own code snippet.

Good luck and hope this helps some.

Chris
Thanks! I was actually considering quickly throwing together a tool that would hook up to one of those online services and translate them in a single batch
Tom the Junglist