| 资产 | 价值 |
|---|---|
| 规则 ID | IDE2000 |
| 标题 | 避免多个空白行 |
| 类别 | Style |
| 子类别 | 语言规则(新行首选项) |
| 适用的语言 | C# 和 Visual Basic |
| Options | dotnet_style_allow_multiple_blank_lines_experimental |
注释
此规则是实验性的,可能会更改或删除。
概述
此样式规则标记源代码中存在多个连续的空白行。 具有多个空白行可以减少代码可读性,通常被视为格式设置不佳的做法。
选项
选项指定希望规则强制实施的行为。 有关配置选项的信息,请参阅 Option 格式。
dotnet_style_allow_multiple_blank_lines_experimental
| 资产 | 价值 | Description |
|---|---|---|
| 选项名称 | dotnet_style_allow_multiple_blank_lines_experimental |
|
| 选项值 | true |
允许多个连续的空白行 |
false |
不允许连续空白行 | |
| 默认选项值 | true |
Example
// dotnet_style_allow_multiple_blank_lines_experimental = true
if (true)
{
DoWork();
}
return;
// dotnet_style_allow_multiple_blank_lines_experimental = false
if (true)
{
DoWork();
}
return;
禁止显示警告
如果只想取消单个冲突,请将预处理器指令添加到源文件以禁用,然后重新启用规则。
#pragma warning disable IDE2000
// The code that's violating the rule is on this line.
#pragma warning restore IDE2000
若要禁用文件、文件夹或项目的规则,请在配置文件中将其严重性设置为none。
[*.{cs,vb}]
dotnet_diagnostic.IDE2000.severity = none
若要禁用所有代码样式规则,请将类别Style的严重性设置为none配置文件中。
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-style.severity = none
有关详细信息,请参阅 如何禁止显示代码分析警告。