ValidateEnumValueAttributeIsValid Method

Determines if the argument's value is defined.

Definition

Namespace: Ookii.CommandLine.Validation
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public override bool IsValid(
	CommandLineArgument argument,
	Object? value
)

Parameters

argument  CommandLineArgument
The argument being validated.
value  Object
The argument value. If not , this must be a string or an instance of CommandLineArgumentArgumentType.

Return Value

Boolean
if the value is valid; otherwise, .

Remarks

If the Mode property is ValidationModeBeforeConversion, the value parameter will be the raw string value provided by the user on the command line.

If the Mode property is ValidationModeAfterConversion, for regular arguments, the value parameter will be identical to the CommandLineArgumentValue property. For multi-value or dictionary arguments, the value parameter will be equal to the last value added to the collection or dictionary.

If the Mode property is ValidationModeAfterParsing, value will always be . Use the CommandLineArgumentValue property instead.

If you need to check the type of the argument, use the CommandLineArgumentElementType property unless you want to get the collection type for a multi-value or dictionary argument.

Exceptions

NotSupportedExceptionargument is not an argument with an enumeration type.

See Also