IntelliTect / IntelliTect/CodingGuidelines

INTL0001 when using records

オープン
#231 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
analyzer C# coding guidelines proposal
主要言語
C#
スター
12
フォーク
16
平均マージ
2分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。