ArgumentValidationAttributeIsValid Method

When overridden in a derived class, determines if the argument is valid.

Definition

Namespace: Ookii.CommandLine.Validation
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public abstract 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.

See Also