Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract class with Resharper 7

Tags:

c#

resharper

In resharper features page:

Extract Class
Enables extracting some of the fields and methods of a class into a separate, newly created class. This refactoring is useful, when a class has grown too large, too incoherent, or does too many things.

I select couple methods within class, open context menu and can't find anything related to extract class, do I miss something?

like image 831
Giedrius Avatar asked Oct 08 '22 02:10

Giedrius


1 Answers

Found it: enter image description here

You need to place your cursor on class name, then in Refactor menu there's Extract class submenu.

But couple tries show, that functionality still needs polishing:

  • would like to have ability simply select methods/fields to be moved to new class and then choose Extract Class,
  • it does not add using statements for newly created class,
  • if moving only static methods it does not mark newly class as static, that means it tries to create instance of it when it is not needed and many other small things :)
like image 53
Giedrius Avatar answered Oct 10 '22 07:10

Giedrius