如何将所有类提取到单独的文件中?

发布于 2024-09-12 05:12:23 字数 119 浏览 3 评论 0原文

我正在使用 Resharper 试用版和 VS2008。是否可以将一个文件中的所有类提取到一个单独的文件中?我可以使用 Resharper 来做到这一点,但它似乎只适用于单个类。这将用于自动生成的 65,000 行长的文件。

I'm using the Resharper trial and VS2008. Is it possible to extract all classes from one file into a separate file? I'm able to do this using Resharper but it only seems to work for individual classes. This is to be used on a file that was auto-generated that is 65,000 lines long.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我的痛♀有谁懂 2024-09-19 05:12:23

如果您使用的是 ReSharper 5,请在解决方案资源管理器上按 Ctrl+Shift+R 调用“重构”菜单(或者右键单击并找到它)并选择“将类型移至匹配文件”

If you're using ReSharper 5, on the solution explorer, press Ctrl+Shift+R to invoke the Refactor menu (or alternatively right-click and locate it) and select "Move Types into Matching Files"

你又不是我 2024-09-19 05:12:23

对于那些运行较新版本的 Visual Studio 的人来说,还有另一种解决方案(我意识到问题提到了 VS 2008)。 Visual Studio 2017 提供的功能类似于 Eduardo Molteni 为 CodeRush 描述的功能。您只需单击类名称,单击左侧的灯泡图标,然后选择“将类型移动到 xxxx.cs”。

Visual Studio 2017移动类

For those that are running a newer version of Visual Studio, there is yet another solution (I realize the question mentions VS 2008). Visual Studio 2017 offers functionality similar to what Eduardo Molteni described for CodeRush. You simply click on a class name, click on the light bulb icon to the left, and select "Move type to xxxx.cs".

Visual Studio 2017 move class

忆悲凉 2024-09-19 05:12:23

除了 Scott 的解决方案之外,Visual Studio Marketplace 中还有一个名为 将类型移至文件

它可以将类型批量移动到它们自己的单独文件中,如下所示:

它还提供了移动光标突出显示的类型的快速快捷方式(默认 Ctrl + Shift + F1)。

为我节省了很多的体力工作......

In addition to Scott's solution, there's a free refactoring tool in Visual Studio Marketplace called Move Type to File.

It can bulk move types to their own separate files, like so:

It also provides a quick shortcut to move a type highlighted by the cursor (default Ctrl + Shift + F1).

Saved me a LOT of manual work...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文