I did a brown bag demo of some VS 2005 stuff today and found that a construct I use a lot : try/catch/finally is not in the standard code snippets so I set about creating it. I was somewhat disappointed not to be able to find an interface within visual studio to do this, so I found the code snippet files and copied one of them. I created a snippet as follows:
<?
<
</
try
{
$selected$
}
catch($expression$)
//Handle exception
finally
$end$
and saved it in a file called trycf.snippet. It's fairly easy to follow what to do, if you want to be able to tab among items you create a <Declaration> and then refer to it by its Id tag ala : $mystuff$. There is a built in $selected$ Declaration in case you use ctrl+k,s to "surround with"
I thought I might make several of these so I made a folder c:\Projects\code snippets and went to Tools-->Code Snippets Manager to tell visual studio about my new snippet. Clicking on "Add" let me browse and find my custom directory, however the behavior in the IDE then changes to the following:
... and I didn't like this, I want to avoid extra keystrokes although I suppose categories might be useful for some people. I'm trying to use snippets to stave off carpal tunnel here people. You can highlight the Visual C# category and chose "import" though and it appears in line with the other snippets.