As developers we are often pushed into over-drive with strict deadlines, and tight sprints. Often we forget about code organization. One way to help maintainability and to keep your code organized is to use #region tags. I often found myself repeatedly typing #regions Fields #endregion #region Properties ….
One easy way to automate this process is to create a code snippet that will fill in all the #regions for you. Code snippets are essentially just an XML file with a .snippet extension. Below is a sample of my code snippet.
In order to import this code snippet into visual studios
- Create a new XML file using the sample code above. For the full xml schema go to http://msdn.microsoft.com/en-us/library/ms171418.aspx
- Now Save the file as “EmptyRegions.snippet”
- Open up the Code Snippet Manager by pressing Ctrl+K, Ctrl+B. or by going to Tools then clicking on Code Snippet Manager

- Click on Import and browse to the location where you saved the file “EmptyRegions.snippet”
- Now choose a location to save your Code Snippet, for this example I selected “My Code Snippets” Click Finished

- You should now see the “EmptyRegions” snippet in your “My Code Snippet” Click OK when finished

Now in the editor just start typing emptyRegions once you see intellisense pop up with the correct short cut, hit tab twice. You should now see the code inserted into the editor


That’s all, now you have a starting point to help keep your code organized without having to repeat yourself over and over and over again.

