Use Base Type Where Possible refactoring
This refactoring helps replace references to a type with references to one of its base types. ReSharper will analyze all references to the type in the whole solution and update those that can be safely replaced with references to the selected base type. Optionally, you can also replace references in is
and typeof
operators.
Replace references to a type with references to one of its base types
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.
Do one of the following:
Press Control+Shift+R and then choose Use Base Type where Possible.
Right-click and choose Refactor | Use Base Type where Possible from the context menu.
Choose
from the main menu.
The Use Base Type where Possible dialog will open.
Select one of base types.
Optionally, select whether you want to replace type usages in the
is
operator and/or in thetypeof
operator.To apply the refactoring, click Next.
If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
This feature is supported in the following languages and technologies:
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.