自定义 resharper 规则以格式化导入

custom resharper rule to format imports

我有一个 c# class 库项目,我们有一个规则强制我们将使用分成两部分,第一部分是 System.* 使用,另一部分是其余使用(每个艺术品按字母顺序排列)。有没有办法强制 resharper 格式化程序以这种方式格式化我的代码?

格式化规则的预期结果如下:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;

using MyNamespace;
using MyNamespace.Test;

您需要的选项是扩展 > ReSharper > 选项 > 代码编辑 > C# > 格式化样式 > 空行 > 声明中的空行 > 不同 "using" 组之间。

考虑使用格式化选项自动检测。 Select 手动格式化代码块(所需格式),Alt-Enter > Format Selection > Detect formatting settings。