What are the best code snippets for C#? (using visual studio) VB has a lot that are pre-defined, but there are only a handful for C#. Do you have any really useful ones for C#?
Anyone want to post a good custom one you created yourself?
What are the best code snippets for C#? (using visual studio) VB has a lot that are pre-defined, but there are only a handful for C#. Do you have any really useful ones for C#?
Anyone want to post a good custom one you created yourself?
There's plenty of code snippets within Visual Studio for basic programming structure but I wouldn't necessarily rate one higher than another.
I would definitely say the best ones are the custom snippets you define yourself to accomplish more specific tasks that you may find yourself using on a regular basis. Definitely a big time saver.
A fairly basic intro to creating custom snippets can be found at http://www.15seconds.com/issue/080724.htm to help with this.
These are the ones I use daily.
I just started a blog, where I document short solutions in C# (code snippets) that I came up with and might prove useful to other coders.
http://thorstenlorenz.blogspot.com/
So far I have mostly blogged about extension methods and generics.
So have a look and tell me what you think.
I had a few on my old blog:
I also have an argnull
code snippet that inserts a Guard Clause that checks an argument for null and throws an ArgumentNullException, but I haven't gotten around to post that yet.
VB has a lot that are pre-defined, but there are only a handful for C#. Do you have any really useful ones for C#?
Microsoft have released a whole bunch of C# snippets that bring it up to parity with the ones for Visual Basic. You can download them here:
Just to update an older thread... here's a link for Visual Studio 2008 C# code snippet download.