Region code snippet
To organize my code, I use a lot of regions to make it more readable. I love regions. Unfortunately, Visual Studio doesn’t provide a default code snippet to define regions. So I created one for myself. I’m publishing the code because I often change from PC or because of reinstalls etc. The internet is always (or most of the time) available, so I can easily download my snippet from here.
The code snippet
Copy the XML to a file and name it “region.snippet”
<Description>Code snippet for an automatically creating a region</Description>
Installing a code snippet
There are two ways to install a code snippet.
First, you can install a snippet by coping it to the Visual Studio User directory, mostly found under “My Documents\Visual Studio 200x\Code Snippets\Visual C#\My Code Snippets”.
Second, you can use the Visual Studio Code Snippets Manager, found under “Tools => Code Snippets Manager”. Just highlight “My Code Snippets”, click the Import button and browse to your custom snippet.
In some cases, the snippet manager mysteriously disappears from the menu bar. You can add the command back by going into Tools/Customize, Click on the Commands Tab, select the Tools Menu, and drag the Code Snippets Manager onto any commandbar that you like.
Want to know more about code snippets?
The msdn site is the place to be!