在 resharper 功能页面中:
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.
我在类中选择几个方法,打开上下文菜单,但找不到与提取类相关的任何内容,我是否遗漏了什么?
最佳答案
发现:
您需要将光标放在类名上,然后在 Refactor 菜单中有 Extract class 子菜单。
但一些尝试表明,该功能仍需要完善:
- 希望能够简单地选择要移动到新类的方法/字段,然后选择“提取类”,
- 它不会为新创建的类添加 using 语句,
- 如果只移动静态方法,它不会将新类标记为静态,这意味着它会在不需要时尝试创建它的实例以及许多其他小事情:)
关于c# - 使用 Resharper 7 提取类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11687796/