CodeRush Xpress

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.

Refactoring - Convert to Auto-implemented Property

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.

Refactoring - Convert to Auto-implemented Property (convert all)

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.
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.