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 the method in Class View, Object Browser, or in the code editor.
  2. On the main menu or context menu, choose  Refactor | Convert Method to Property.
  3. In the dialog box that opens, specify a property name:
    Convert Method to Property refactoring
  4. Click  OK to change the selected 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 following example:

After changing the method setX to a write property X the code looks as follows:

See Also