ReSharper Web Help

The Convert Method to Property refactoring converts non-void methods without parameters to read properties, and void methods with exactly one parameter to write properties.

To change a method to a read or write property
  1. Place the caret at the name of a method in the editor, in the File Structure window, in Class View or in Object Browser.
  2. Do one of the following:
    • On the main menu, choose Refactor | Convert | Method to Property.
    • Press Ctrl+Shift+R and click Convert Method to Property.
  3. The Convert Method to Property dialog opens. Type a property name into the Property name box or leave the default one:
  4. Click Next to change the method to a read or a write property. At the same time, all method calls will be substituted with the corresponding property accesses.

Consider the example below:

After applying the refactoring, the GetFilteredChildren method is replaced with the FilteredChildren property:

See Also

Procedures