IntelliTect / IntelliTect/CodingGuidelines

INTL0001 when using records

Abierto
#231 0 comentarios 0 reacciones 0 asignados Ver en GitHub
analyzer C# coding guidelines proposal
Lenguaje dominante
C#
Estrellas
12
Forks
16
Merge medio
2 min
PR fusionados (30 d)
7

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.