Shortcut to create a field from a property in Visual Studio

Is there any shortcut in VS to define a field from the corresponding property ?

+7
visual-studio-2012 shortcut
source share
1 answer

if you want to create a backup storage for an automatically generated property:

public string MyProperty { get; set; } 

To:

  public string _myProperty; public string MyProperty { get { return _myProperty; } set { _myProperty = value; } } 

Then there is no shortcut that does this in Visual Studio . Refactoring tools like Resharper and CodeRush offer this feature.

In Visual Studio, there is an Encapsulate field that works differently ctrl + r , e .

  public string _myProperty; 

To:

  public string _myProperty; public string MyProperty { get { return _myProperty; } set { _myProperty = value; } } 
+10
source share

All Articles