Skip to content

Commit

Permalink
Extended AV1135 with Task-specified defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen authored and mapfel committed Mar 22, 2021
1 parent 39be1c5 commit 84feff4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _pages/1100_MemberDesignGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You generally don't want callers to be able to change an internal collection, so

### <a name="av1135"></a> Properties, arguments and return values representing strings or collections should never be `null` (AV1135) ![](/assets/images/1.png)

Returning `null` can be unexpected by the caller. Always return an empty collection or an empty string instead of a `null` reference. This also prevents cluttering your code base with additional checks for `null`, or even worse, `string.IsNullOrEmpty()`.
Returning `null` can be unexpected by the caller. Always return an empty collection or an empty string instead of a `null` reference. When your member return `Task` or `Task<T>`, return `Task.CompletedTask` or `Task.FromResult()`. This also prevents cluttering your code base with additional checks for `null`, or even worse, `string.IsNullOrEmpty()`.

### <a name="av1137"></a> Define parameters as specific as possible (AV1137) ![](/assets/images/2.png)

Expand Down

0 comments on commit 84feff4

Please sign in to comment.