ArgumentConverter Class

Base class for converters from a string to the type of an argument.

Definition

Namespace: Ookii.CommandLine.Conversion
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 5.0.0+724ca9b7fa5edc075ec2ae65044e61b0d494fd1c
C#
public abstract class ArgumentConverter
Inheritance
Object    ArgumentConverter
Derived
More

Remarks

To create a custom argument converter, you must implement the Convert(ReadOnlyMemoryChar, CultureInfo, CommandLineArgument) method.

The source of the conversion is a ReadOnlyMemoryT that contains the argument text. This may be an entire argument, or a substring of an argument if the user used a non-whitespace argument name separator like -Name:Value.

ReadOnlyMemoryT is used because ReadOnlyMemoryTToString does not allocate when the memory is an entire string. However, since it still allocates for substrings, it's still recommended to convert using the ReadOnlyMemoryT or ReadOnlySpanT directly if possible.

Constructors

ArgumentConverterInitializes a new instance of the ArgumentConverter class

Methods

Convert Converts a string memory region to the type of the argument.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

See Also