CommandLineArgumentConvertToArgumentType Method

Converts the specified string to the ElementType.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public Object? ConvertToArgumentType(
	CultureInfo culture,
	string? argumentValue
)

Parameters

culture  CultureInfo
The culture to use for conversion.
argumentValue  String
The string to convert.

Return Value

Object
The converted value.

Remarks

Conversion is done by one of several methods. First, if a ArgumentConverterAttribute was present on the property or method that defined the argument, the specified ArgumentConverter is used. Otherwise, the type must implement ISpanParsableTSelf, implement IParsableTSelf, or have a static Parse(String, IFormatProvider) or Parse(String) method, or have a constructor that takes a single parameter of type String.

Exceptions

ArgumentNullExceptionculture is
CommandLineArgumentExceptionargumentValue could not be converted to the type specified in the ArgumentType property.

See Also