You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider a different return type for Symbol.Aliases #1945
I totally expected option.Aliases[0] to work, but it requires Enumerable.First instead.
In System.CommandLine 2.0.0-beta4.22272.1, the collection is a HashSet<string> and thus does not preserve order. However, I feel it might be better to preserve order here and instead make the parser build a Dictionary<string, Symbol>.
Activity
KalleOlaviNiemitalo commentedon Nov 10, 2022
I totally expected
option.Aliases[0]to work, but it requires Enumerable.First instead.In System.CommandLine 2.0.0-beta4.22272.1, the collection is a HashSet<string> and thus does not preserve order. However, I feel it might be better to preserve order here and instead make the parser build a Dictionary<string, Symbol>.
command-line-api/src/System.CommandLine/IdentifierSymbol.cs
Line 14 in 209b724
command-line-api/src/System.CommandLine/IdentifierSymbol.cs
Lines 37 to 40 in 209b724
KalleOlaviNiemitalo commentedon Mar 29, 2023
Since #2073, it is
ICollection<string> Aliases { get; }, backed by internal class AliasSet:command-line-api/src/System.CommandLine/Command.cs
Line 91 in fe66356
command-line-api/src/System.CommandLine/Option.cs
Line 105 in fe66356
command-line-api/src/System.CommandLine/AliasSet.cs
Line 7 in fe66356
(Argument and Directive do not have an Aliases property. It would not be useful for Argument, but could be for Directive.)