ReSharper Web Help

The Convert Property to Method(s) refactoring converts type properties to getter and/or setter methods. Namely, each read property is converted to a getter method, each write property is converted to a setter method, and each read-write property is converted to two separate methods: a getter and a setter.

To change a property to setter/getter methods
  1. Place the caret at the name of the property in Class View, Object Browser, or in the code editor.
  2. On the main menu or context menu, choose Refactor | Convert Property to Method(s):
    Convert Property to Method refactoring
  3. In the dialog box that opens, specify the names of the getter and/or setter methods.


    For a read-write property you may generate a pair of getter-setter methods, or either getter or setter, by selecting the appropriate check boxes. You also have the possibility to change the default method names suggested by ReSharper.
  4. Click Continue. The property changes to getter/setter method(s). At the same time, all usages of the property (both read and write) will be substituted with the corresponding method calls.

Consider the following example:

After converting property X to a pair of getter/setter methods, the code looks as follows:

See Also