IntelliTect / IntelliTect/CodingGuidelines

INTL0001 when using records

未关闭
#231 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
analyzer C# coding guidelines proposal
主要语言
C#
星标
12
派生
16
平均合并
2 分钟
30 天内合并 PR
7

描述

With the introduction of positional records it has become more valuable to apply attributes inline. This is especially true when dealing with serialization.
Consider the following which triggers INTL0001 (Properties must be on their own line)

```C#
public record MyDto([property:JsonPropertyName("my_Value")] string Value);
```

The work around is to simply do as the analyzer suggests and put it on its own line:
```C#
public record MyDto(
[property:JsonPropertyName("my_Value")]
string Value);
```
However, I would posit that this is less readable that the original.

We should revisit the attribute guidelines with these new use-cases in mind.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。