dotnet / dotnet/command-line-api

The default value of a nullable "Array", "IEnumerable<T>", "IList<T>" or "ICollection<T>" should be "null"

Open
#2,232 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

I noticed that the default value of `CliOption?>` always ends up being an empty list. This seems counterintuitive to me, as I explicitly defined the list to be nullable. The same applies for the types mentioned in the title.

Would it be possible to add some additional checks if the type is nullable here? https://github.com/dotnet/command-line-api/blob/6daed85086c41a1cd72a97f298f9cfe2beafa3f4/src/System.CommandLine/Argument%7BT%7D.cs#L168

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.