Alias Varghese Alias Varghese - 4 months ago 24
C# Question

Shortcut to change property to full property

I already have a property like this

public int MyProperty{get; set;}

I need to change this property as a full property like this

private int myVar;

public int MyProperty
get { return myVar;}
set { myVar = value;}

any shortcut available in VS2013 for this?


In VS2015, Right click on myVar -> Quick Actions...-> Encapsulate field

Even better if you first rename it as m_myVar -> Visual studio will generate a property named MyVar

Don't have VS2013 right now, but should be the same, maybe no need for "Quick actions..."