Steeltoe
Steeltoe copied to clipboard
Address S3956: "Generic.List" instances should not be part of public APIs
Address existing violations of S3956: "Generic.List" instances should not be part of public APIs in the codebase and set severity to Warning in Steeltoe.Debug.ruleset and Steeltoe.Release.ruleset.
To find existing violations, enable the rule (see above) and rebuild src/Steeltoe.All.sln to make them appear in the Output window.
To address the violations, choose from the following on a case-by-case basis:
- Fix the violation by changing the code to not violate the rule
- Prefer collection interfaces such as
ICollection<>andIDictionary<,>over arrays, list and dictionaries for inputs and outputs- Be hesitant with incoming
IEnumerable<>parameters: the implementation may change over time, causing the need for multiple enumerations, which may result in undesired side effects - Consider to return unchangeable collections, such as
IReadOnlyCollection<>,IReadOnlyDictionary<,>andIImmutableList<T>
- Be hesitant with incoming
- Prefer collection interfaces such as
- Suppress the violation in code using
#pragma warning disable/restore, preceded by a justification comment if not obvious
Related to #916 and #946.