c# - 在整个代码库上重构 "using"指令?

标签 c# visual-studio-2008 refactoring using-directives

我喜欢 Visual Studio 2008 的一个原因是能够重构和重组源代码文件中的“using”指令(这可能也是在 2005 年发生的,我不记得了)。

具体来说,我说的是如何让它重新组织指令以按字母顺序排列(尽管核心 FCL 库 float 到顶部)并删除不需要存在的任何指令(要么从未使用过)或不再使用)。

有没有什么方法可以在整个旧代码库中自动进行这种重构(排序和修整)?通过解决方案中的所有文件或跨多个解决方案文件。

最佳答案

我相信您可以使用 Power Commands 解决广泛的问题

来自 PowerCommands 文档:

Remove and Sort Usings This command removes and sort using statements for all classes given a project. It is useful, for example, in removing or organizing the using statements generated by a wizard. This command can be executed from a solution node or a single project node.

关于c# - 在整个代码库上重构 "using"指令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/517780/

相关文章:

c# - 抛出新的 NotImplementedException()

c# - 如何在不显式创建类的情况下创建要传递的临时对象?

delphi - Delphi Prism/VS 2008:一键式从代码切换到设计?

c# - XAML设计器因自注册ViewModel而崩溃

c# - C# 的 GIL 版本是什么?

sql - 代码重构 SQL Server 数据库对象名称更改

refactoring - 方法重构

xml - 重构 XSD 架构

c# - Visual Studio 2008 的圈复杂度

c++ - GetWindowRect 坐标不是屏幕相关的