A Visual Studio snippet for a class with #region sections

Here is a simple snippet to add to Visual Studio if you want:

Place it here for Visual Studio 2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Visual C#

<?xml version="1.0" encoding="utf-8" ?>
<codeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<codeSnippet Format="1.0.0">
		<header>
			<title>classr</title>
			<shortcut>classr</shortcut>
			<description>Code snippet for class with prepopulated regions.</description>
			<author>Microsoft Corporation</author>
			<snippetTypes>
				<snippetType>Expansion</snippetType>
				<snippetType>SurroundsWith</snippetType>
			</snippetTypes>
		</header>
		<snippet>
			<declarations>
				<literal>
					<id>name</id>
					<toolTip>Class name</toolTip>
					<default>MyClass</default>
				</literal>
			</declarations>
			<code Language="csharp"><!&#91;CDATA&#91;class $name$
	{
	#region Member Fields
	#endregion

	#region Constructor
	/// <summary>
	/// The default constructor
	/// </summary>
	public $name$()
	{
	}
	#endregion

	#region Properties
	#endregion

	#region Functions
	#endregion

	#region enums
	#endregion
		$selected$$end$
	}&#93;&#93;>
			</code>
		</snippet>
	</codeSnippet>
</codeSnippets>

Leave a Reply