我喜欢 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/