ArgumentValidationAttribute.ValidateSpan Method

Validates the argument value, and throws an exception if validation failed.

Definition

Namespace: Ookii.CommandLine.Validation
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public bool ValidateSpan(
	CommandLineArgument argument,
	ReadOnlySpan<char> value
)

Parameters

argument  CommandLineArgument
The argument being validated.
value  ReadOnlySpan<Char>
The argument value. If not null, this must be an instance of CommandLineArgument.ArgumentType.

Return Value

Boolean
true if validation was performed and successful; false if this validator doesn't support validating spans and the Validate(CommandLineArgument, Object) method should be used instead.

Remarks

The CommandLineParser class will only call this method if the Mode property is ValidationMode.BeforeConversion.

Exceptions

CommandLineArgumentException The value parameter is not a valid value. The CommandLineArgumentException.Category property will be the value of the ErrorCategory property.

See Also