ReSharper 8.0 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+RCtrl+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.

This feature is supported in the following languages/technologies:

C# VB.NET HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
feature_available feature_available


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.