How to quickly create class properties in Visual Studio

In Visual Studio 2010 (and probably earlier versions) there is a shortcut for writing out class properties.

Say you wanted to create a Person class with the properties FirstName, LastName, and PersonID. After you construct the Person class…

public class Person()


type in the keyword “prop”, then hit TAB-TAB.

So, this…

public class Person()
  prop [TAB] [TAB]

will turn into this…

public class Person()
  public int MyProperty { get; set; }

At this point you can change the type (int) and/or the name of the property (MyProperty). To toggle back and forth between the int and the name, hit your TAB key.

When the property is just as you like it, hit [ENTER][ENTER]. This will take you to a new line where you can repeat the process of quickly creating your class properties.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s