The Move Static Member refactoring allows users to move inner classes, static fields and methods to another type. All corresponding references and usages are automatically updated, including scenarios where a member uses other members of its original type.

 Tip

To move a non-static method, perform the following sequence of refactorings: Make Method Static ->  Move Static Member ->Make Method Non-Static.
To move a static member or an inner type
  1. Position the caret at a static member or an inner type.
  2. Choose ReSharper | Refactor | Move, or press F6.
  3. If you selected an inner type, the following dialog box opens:
    Move Static Member refactoring
  4. Select Another type, and click Next.

     Note

    If you select Outer Scope, the Move Type to Outer Scope refactoring is performed.
  5. If you selected a static field or method (or if you chose to move an inner type to another type), the following dialog box opens:
    Move Static Member refactoring
    The dialog box displays all static members of the containing class, and its inner types. You can select check boxes next to the items you want to move.

     Tip

    If the refactored static member uses another static member of the same class, ReSharper highlights the used member in blue and shows a corresponding tooltip.
  6. Type or browse to the name of the destination class. In the latter case, you can search for a type using a drop-down tree view:
    Move Static Member refactoring
  7. Select check boxes next to members that you want to move. Note that you can move several static class members and inner types at once.
  8. Select a custom access level, or leave it "as is".
  9. Click Next. If no conflicts are found, ReSharper performs the refactoring immediately.

See Also

Procedures