ReSharper 2017.3 Help

Move Type to Another File refactoring

ReSharper | Refactor | Moveā€¦
F6
ReSharper_Move

This refactoring helps you move the selected type from the current file to any existing file or to a new file. If you are moving to a new file, the new file is created automatically. If there are no more types in the current file, it can be removed. All necessary imports are moved with the type. All imports that are no longer necessary are removed from the original file.

If you invoke this refactoring on a nested type, ReSharper will make the parent class partial, create a new file for the new part of the partial class, and move the selected type there. If necessary, you can then use the Move Type to Outer Scope refactoring to make the type non-nested and simply remove the redundant part of the parent class.

To move a type to another file

  • Type a file name in the New file name text box. You can specify the name for an existing file or a new one. In the latter case, the new file is created in the current project or folder.
ReSharper. Move to another file 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 Feature is available Feature is not available Feature is available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not 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.

Last modified: 22 February 2018

See Also

Procedures: