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
namespace System.CommandLine {
public partial class ArgumentValidation {
+ public static Argument<TEnum> AcceptOnlyFromAmong<TEnum>(+ this Argument<TEnum> argument,+ params TEnum[] values)+ where TEnum: struct, System.Enum;
}
public partial class OptionValidation {
+ public static Option<TEnum> AcceptOnlyFromAmong<TEnum>(+ this Option<TEnum> option,+ params TEnum[] values)+ where TEnum: struct, System.Enum;
}
}
Same behaviour as in Argument.AcceptOnlyFromAmong(params string[]) and Option.AcceptOnlyFromAmong(params string[]), except:
These are only applicable for enum types
The return type is different (but still matches the this parameter)
The values parameter is TEnum[] rather than string[], and the method calls ToString or similar on each value (not sure what to do about values composed of multiple bit flags)
namespace System.CommandLine { public partial class ArgumentValidation { + public static Argument<TEnum> AcceptOnlyFromAmong<TEnum>( + this Argument<TEnum> argument, + params TEnum[] values) + where TEnum: struct, System.Enum; } public partial class OptionValidation { + public static Option<TEnum> AcceptOnlyFromAmong<TEnum>( + this Option<TEnum> option, + params TEnum[] values) + where TEnum: struct, System.Enum; } }Same behaviour as in Argument.AcceptOnlyFromAmong(params string[]) and Option.AcceptOnlyFromAmong(params string[]), except:
thisparameter)valuesparameter is TEnum[] rather than string[], and the method calls ToString or similar on each value (not sure what to do about values composed of multiple bit flags)AcceptOnlyFromAmongwithbool ignoreCase = false#2254)command-line-api/src/System.CommandLine/Binding/ArgumentConverter.cs
Line 61 in 209b724
Inspired by #1959 (comment)