ArgumentConverterConvert(ReadOnlySpanChar, CultureInfo, CommandLineArgument) Method

Converts a string span to the type of the argument.

Definition

Namespace: Ookii.CommandLine.Conversion
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public virtual Object? Convert(
	ReadOnlySpan<char> value,
	CultureInfo culture,
	CommandLineArgument argument
)

Parameters

value  ReadOnlySpanChar
The ReadOnlySpanT containing the string to convert.
culture  CultureInfo
The culture to use for the conversion.
argument  CommandLineArgument
The CommandLineArgument that will use the converted value.

Return Value

Object
An object representing the converted value.

Remarks

The default implementation of this method will allocate a string and call Convert(String, CultureInfo, CommandLineArgument). Override this method if a direct conversion from a ReadOnlySpanT is possible for the target type.

Exceptions

ArgumentNullExceptionculture or argument is .
FormatException The value was not in a correct format for the target type.
OverflowException The value was out of range for the target type.
CommandLineArgumentException The value was not in a correct format for the target type. Unlike FormatException and OverflowException, a CommandLineArgumentException thrown by this method will be passed down to the user unmodified.

See Also