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.
The reverse functionality is provided by the Convert Method to Indexer (Default Property) refactoring.
- Place the caret at an indexer in the editor or select it in the File Structure window.
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+RCtrl+Shift+R, then click Convert Indexer to Method.
The Convert Indexer to Method dialog box opens:
- 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.
- Click Next. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, resolve conflicts.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.