
* S6674: add how to fix section * S6677: add how to fix section * S2629: add how to fix section * S6670: add how to fix section * S1312: add how to fix section * S6672: add how to fix section * S6670: add compliant/noncompliant headers * S6669: add how to fix section * S6668: add how to fix section * S2629: remove method definition * S6669: update formatting * S6670: add links * Fix formatting
38 lines
856 B
Plaintext
38 lines
856 B
Plaintext
include::../why-dotnet.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
Update the name of the field or property to follow the configured naming convention. By default, the following names are considered compliant:
|
|
|
|
* `{logger}`
|
|
* ``++{_logger}++``
|
|
* `{Logger}`
|
|
* ``++{_Logger}++``
|
|
* `{log}`
|
|
* ``++{_log}++``
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
private readonly ILogger myLogger; // Noncompliant
|
|
|
|
public ILogger MyLogger { get; set; } // Noncompliant
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,csharp,diff-id=1,diff-type=compliant]
|
|
----
|
|
private readonly ILogger logger; // Compliant
|
|
|
|
public ILogger Logger { get; set; } // Compliant
|
|
----
|
|
|
|
== Resources
|
|
|
|
=== Documentation
|
|
|
|
* Microsoft Learn - https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions[Coding conventions]
|
|
|
|
include::../rspecator.adoc[] |