ReSharper 2016.1 Help

Copy Type

ReSharper | Refactor | Copy Type…

This refactoring allows you to copy a class, interface, struct, or enum defined in your solution from one namespace to another, or clone it within the same namespace. For partial types, all parts will be copied even if they are located in separate files.

To copy a type

  1. Select a type in one of the following ways:
    • In the editor, set the caret at the name of a type.
    • Select a type in the Solution Explorer.
    • Select a type in the File Structure Window.
    • Select a type in the Class View.
    • Select a type in the Object Browser.
    • Select a type in the type dependency diagram.
  2. Do one of the following:
    • Press Ctrl+Shift+R and then choose Copy Type
    • Right-click and choose Refactor | Copy Type on the context menu.
    • Choose ReSharper | Refactor | Copy Type… in the main menu.
    The Copy Type dialog will open.
  3. Specify a name for the copied type and a namespace where it should be added.
  4. To apply the refactoring, click Next.
  5. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
ReSharper. Copy Type refactoring

This feature is supported in the following languages/technologies:

C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts Protobuf JSON
feature_available feature_available 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 corresponding topics in the ReSharper by Language section.

See Also

Last modified: 19 August 2016