Reputation: 2172
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?
Upvotes: 1
Views: 1459
Reputation: 11
Type "propfull"
in the editor and press TAB
twice, change the property type if desired.
Press TAB
again to change backing name and property name if desired.
Upvotes: 1
Reputation: 4249
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..."
Upvotes: 1