ReSharper Web Help

Use this refactoring to convert:

  • Get accessor of an indexer (default property in VB.NET) to a method with return value and a set of parameters that match those of the original indexer.
  • Set accessor of an indexer, if any, to a void method with a set of indexer parameters and a value parameter.
Usages of indexers will be converted accordingly to call those methods.

The reverse functionality is provided by the Convert Method to Indexer (Default Property) refactoring.

To convert an indexer (default property) to a method
  1. Place the caret at an indexer in the editor or select it in the File Structure window.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Refactor | Convert | Indexer to Method.
    • Right-click, then click Refactor | Convert | Indexer to Method on the context menu.
    • Press Ctrl+Shift+R, then click Convert Indexer to Method.
  3. The Convert Indexer to Method dialog box opens:

  4. Use Convert getter and Convert setter check boxes to choose which accessors to convert, and specify target method names in Getter name and Setter name text boxes.
  5. Click Next. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, resolve conflicts.

See Also

Procedures