visual-studio-2010 - 使用 ReSharper 和 Visual Studio 2010 自动重构导入/使用指令

标签 visual-studio-2010 refactoring resharper using

我想自动化 Visual Studio 2010/Resharper 5 自动插入导入指令,以将我的内部命名空间放入命名空间领域。像这样:

using System;
using System.Collections.Generic;
using System.Linq;
using StructureMap;
using MyProject.Core;          // <--- Move inside.
using MyProject.Core.Common;   // <--- Move inside.

namespace MyProject.DependencyResolution
{
    using Core;
    using Core.Common;   // <--- My internal namespaces to be here!

    public class DependencyRegistrar
    {
        ...........
    }
}

目前,我正在手动执行此操作,问题在于每次重构 using 指令时,都会一直到页面的开头。

最佳答案

在 R# 5.0 中:

ReSharper->工具->清理代码。或者只需按 Ctrl+E、Ctrl+C。

然后使用已打开“优化‘使用’指令”的配置文件。

关于visual-studio-2010 - 使用 ReSharper 和 Visual Studio 2010 自动重构导入/使用指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2742426/

相关文章:

java - Eclipse JDT : How do I auto-move dependencies of a statement as well, 同时移动语句

c# - 我应该保留这个静态变量,还是重构它?

c++ - 在 C++ 项目中构建事件

c# - 如何在多个项目中使用 useLegacyV2RuntimeActivationPolicy?

visual-studio-2010 - 哪个 Microsoft.Office.Interop.Outlook 版本可与 Outlook 2003 配合使用?

c# - 这种双重实例化是有害的,还是根本没有必要?

c# - 声明字段和构造函数注入(inject)的最快方法

c# - C# 和 VB.NET 中的即时窗口行为差异

java - 在 Switch-Case-Smell 上重构或使用设计模式

visual-studio-2010 - Resharper:带有 tab+tab 的代码片段