Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit 918f92f

Browse files
Bart KoelmanBart Koelman
authored andcommitted
Adapt for dennisdoomen/CSharpGuidelines#216: AV1130: No longer allow changeable collection interfaces and types to be returned, except from private methods.
1 parent a338f3b commit 918f92f

5 files changed

Lines changed: 455 additions & 135 deletions

File tree

docs/Overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This analyzer reports when a member has the `new` modifier in its signature.
2020
This analyzer reports when a member has the word "And" in its name.
2121

2222
### [AV1130](https://github.com/dennisdoomen/CSharpGuidelines/blob/7a66f7468da6ce1477753a02e416e04bc9a44e45/_pages/1100_MemberDesignGuidelines.md#av1130): Return an `IEnumerable<T>` or `ICollection<T>` instead of a concrete collection class ![](/images/warn.png "severity: warning")
23-
This analyzer reports when a method return type is a `class` or `struct` that implements `IEnumerable` and is not an immutable collection.
23+
This analyzer reports when the return type of a public or internal method implements `IEnumerable` and is changeable (for example: `List<string>` or `ICollection<int>`). Instead, return `IEnumerable<T>`, `IReadOnlyCollection<T>`, `IReadOnlyList<T>`, `IReadOnlySet<T>`, `IReadOnlyDictionary<TKey, TValue>` or an immutable collection.
2424

2525
### [AV1135](https://github.com/dennisdoomen/CSharpGuidelines/blob/7a66f7468da6ce1477753a02e416e04bc9a44e45/_pages/1100_MemberDesignGuidelines.md#av1135): Properties, arguments and return values representing strings or collections should never be `null` ![](/images/warn.png "severity: warning")
2626
This analyzer reports when `null` is returned from a method, local function, lambda expression or property getter which has a return type of string, collection or task.

0 commit comments

Comments
 (0)