ArgumentValidationAttribute.IsSpanValid 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 virtual bool? IsSpanValid(
	CommandLineArgument argument,
	ReadOnlySpan<char> value
)

Parameters

argument  CommandLineArgument
The argument being validated.
value  ReadOnlySpan<Char>
The raw string argument value provided by the user on the command line.

Return Value

Nullable<Boolean>
null if this validator doesn't support validating spans, and the regular IsValid(CommandLineArgument, Object) method should be called instead; true if the value is valid; otherwise, false.

Remarks

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

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

The base class implementation returns null.

See Also