Full property with backing field code snippet in Microsoft Visual Studio 2010

New in Microsoft Visual Studio 2010 is the “propfull” code snippet. It produces the code for a complete property with backing field.

Press CTRL + spacebar and select [propfull], now press [Tab] once, this will generate the code.
When you press [Tab] a second time you can change the type and name of the property.
You can also directly type propfull in you’re editor and press [Tab].

 

image

 

Generated code

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Ada.Tts.Toggle.Silverlight
{
public class Task
{
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

One comment

  1. […] Knowledgebase » Blog Archive » Full property code snippet in … […]