Visual Studio Missing Properties Code Snippets

Hi all,

CodeSnippets within Visual Studio are very handy to speed up the coding process and reduce the amount of typing that you have to do. In particular if you have to create classes with a lot of properties it can save a lot time if you can automate it. Unfortunately the standard property only creates Get/Sets but doesn't automate placing the variable names. If you add this following snippet to your folder: "C:\Users\<YourUserName>\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets\propc.snippet" you can access via Ctrl-K-X your new snippet!

 <?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="">
<CodeSnippet Format="1.0.0">
<Description>Code snippet for property and backing field</Description>
<Author>Microsoft Corporation</Author>
<ToolTip>Property type</ToolTip>
<ToolTip>Property name</ToolTip>
<ToolTip>The variable backing this property</ToolTip>
<Code Language="csharp"><![CDATA[private $type$ $field$;
public $type$ $property$
get { return $field$;}
set { $field$ = value;}

Happy Coding!

Skip to main content