c# - 使用 Resharper 7 提取类

标签 c# resharper

在 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.

我在类中选择几个方法,打开上下文菜单,但找不到与提取类相关的任何内容,我是否遗漏了什么?

最佳答案

发现: enter image description here

您需要将光标放在类名上,然后在 Refactor 菜单中有 Extract class 子菜单。

但一些尝试表明,该功能仍需要完善:

  • 希望能够简单地选择要移动到新类的方法/字段,然后选择“提取类”,
  • 它不会为新创建的类添加 using 语句,
  • 如果只移动静态方法,它不会将新类标记为静态,这意味着它会在不需要时尝试创建它的实例以及许多其他小事情:)

关于c# - 使用 Resharper 7 提取类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11687796/

相关文章:

c# - 创建一个虚拟 HWND 以传递给 Direct3D

c# - 如何停止 ReSharper 删除对象初始化程序中的空格

.net - 是否可以从另一个设置文件中获取 Resharper 设置文件 'inherit'?

c# - ReSharper 警告仍显示为 UsedImplicitlyAttribute

c# - 如何找到相机视野所包含的区域?

c# - 如何确保在崩溃时保存应用程序状态 C#

c# - 在 C# 应用程序中处理位图

c# - 对资源和 GetManifestResourceNames() 感到困惑

c# - 编写接受用户输入的 Resharper ContextAction

c# - Resharper 重构模式将局部变量赋值包装在 try catch 中