Skip to content

Commit

Permalink
Adapt for dennisdoomen/CSharpGuidelines#216: AV1130: No longer allow …
Browse files Browse the repository at this point in the history
…changeable collection interfaces and types to be returned, except from private methods.
  • Loading branch information
renamorales309 committed Feb 2, 2022
1 parent 1a91701 commit c034b89
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 135 deletions.
2 changes: 1 addition & 1 deletion docs/Overview.md
Expand Up @@ -20,7 +20,7 @@ This analyzer reports when a member has the `new` modifier in its signature.
This analyzer reports when a member has the word "And" in its name.

### [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")
This analyzer reports when a method return type is a `class` or `struct` that implements `IEnumerable` and is not an immutable collection.
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.

### [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")
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.
Expand Down

0 comments on commit c034b89

Please sign in to comment.