Refactorings for Properties and Fields
Convert to Auto-implemented Property
This refactoring is only available in C#. Removes the backing store and converts the active property to a C# auto-implemented property. Available when the caret is on the property name. 
Convert to Auto-implemented Property (convert all)
This refactoring is only available in C#. Converts all properties in the active C# type to auto-implemented properties, removing the associated backing store fields. 
Create Backing Store
This refactoring is only available in C#. Converts a C# auto-implemented property to a conventional property with a backing store. Before:
[C#]
public string StartingFolder { get; private set; }
After:
[C#]
private string _StartingFolder; public string StartingFolder { get { return _StartingFolder; } private set { _StartingFolder = value; } }
Encapsulate Field
Encapsulates a field into a read-write property and replaces all occurrences of this field with the newly declared property. In C# control is passed to the built-in refactoring that encapsulates fields. In Visual Basic CodeRush Xpress implements this refactoring.
Encapsulate Field (read only)
Encapsulates a field into a read-only property and replaces all read-references to this field with the newly declared property.
Method to Property
Creates a property from the current method. Before:
[C#]
public string GetStartingFolder() { return _StartingFolder; }
After:
[C#]
public string StartingFolder { get { return _StartingFolder; } }
Property to Method(s)
- For read-only properties:
Converts the property into a function.
- For write-only properties:
Converts the property into a method (or Sub in Visual Basic).
- For read/write properties:
Converts the property into two methods, creating a new function for the getter, and a new method for the setter.
|