ReSharper 2024.3 Help

Push Members Down refactoring

This refactoring helps move members and interface implementations from a base type to one or more direct inheritors of this type. For example, if you have class MyBaseClass : IMyInterface and class MyDerivedClass : MyBaseClass, this refactoring can help you move members of MyBaseClass to MyDerivedClass and/or move the entire implementation of IMyInterface to MyDerivedClass.

Push members down

  1. Select a type in one of the following ways:

    • In the editor, place the caret at the name of a type.

    • Select a type in the Solution Explorer.

    • Select a type in the File Structure window window.

    • Select a type in the Class View.

    • Select a type in the Object Browser.

    • Select a type in the type dependency diagram.

    Or, alternatively, select a member in the editor or in a tool window.

  2. Do one of the following:

    • Press Control+Shift+R and then choose Push Members Down.

    • Right-click and choose Refactor | Push Members Down from the context menu.

    • Choose ReSharper | Refactor | Push Members Down… from the main menu.

    The Push Members Down dialog will open.

  3. Select one or more destination types from the list of inheritors.

  4. Select members and/or interfaces that you want to move. You can also click All Public to quickly select all public members and/or Dependent to select members that are referenced by other selected members or implement the selected interfaces.

  5. For any member, you can select Make abstract (if applicable) to make the member abstract in the current class and create its implementation(s) in the target inheritor class(es).

  6. To apply the refactoring, click Next.

  7. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.

ReSharper. Push Members Down refactoring

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: HTML

Language: ASP.NET

Language: Razor

Language: JavaScript

Language: TypeScript

Language: CSS

Language: XML

Language: XAML

Language: Resx

Language: Build Scripts

Language: Protobuf

Language: JSON

Feature is available in C#

Feature is available in Visual Basic

Feature is not available in C++

Feature is not available in HTML

Feature is not available in ASP.NET

Feature is not available in Razor

Feature is not available in JavaScript

Feature is not available in TypeScript

Feature is not available in CSS

Feature is not available in XML

Feature is available in XAML

Feature is not available in Resource files

Feature is not available in build script files

Feature is not available in Protobuf

Feature is not available in JSON

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the Languages and frameworks section.

Last modified: 23 September 2024