CommandLineParserT Class

A generic version of the CommandLineParser class that offers strongly typed Parse and ParseWithErrorHandling methods.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public class CommandLineParser<T> : CommandLineParser
where T : class
Inheritance
Object    CommandLineParser    CommandLineParserT

Type Parameters

T
The type that defines the arguments.

Remarks

This class provides the same functionality as the CommandLineParser class. The only difference is that the Parse method, the ParseWithErrorHandling method, and their overloads return the arguments type, which avoids the need to cast at the call site.

Constructors

CommandLineParserT(ParseOptions) Initializes a new instance of the CommandLineParser class using the specified options.
CommandLineParserT(ArgumentProvider, ParseOptions) Initializes a new instance of the CommandLineParser class using the specified argument provider and options.

Properties

AllowDuplicateArguments Gets a value indicating whether duplicate arguments are allowed.
(Inherited from CommandLineParser)
AllowWhiteSpaceValueSeparator Gets a value indicating whether the name and the value of an argument may be in separate argument tokens.
(Inherited from CommandLineParser)
ApplicationFriendlyName Gets the friendly name of the application for use in the version information.
(Inherited from CommandLineParser)
ArgumentNameComparison Gets the string comparison used for argument names.
(Inherited from CommandLineParser)
ArgumentNamePrefixes Gets the argument name prefixes used by this instance.
(Inherited from CommandLineParser)
Arguments Gets the arguments supported by this CommandLineParser instance.
(Inherited from CommandLineParser)
ArgumentsType Gets the type that was used to define the arguments.
(Inherited from CommandLineParser)
Culture Gets the culture used to convert command line argument values from their string representation to the argument type.
(Inherited from CommandLineParser)
Description Gets a description that is used when generating usage information.
(Inherited from CommandLineParser)
HelpArgument Gets the automatic help argument, or an argument with the same name, if there is one.
(Inherited from CommandLineParser)
HelpRequested Gets or sets a value that indicates whether usage help should be displayed if the Parse(String) method returned .
(Inherited from CommandLineParser)
LongArgumentNamePrefix Gets the prefix to use for long argument names.
(Inherited from CommandLineParser)
Mode Gets the command line argument parsing rules used by the parser.
(Inherited from CommandLineParser)
NameValueSeparators Gets the characters used to separate the name and the value of an argument.
(Inherited from CommandLineParser)
Options Gets the options used by this instance.
(Inherited from CommandLineParser)
ParseResult Gets the result of the last command line argument parsing operation.
(Inherited from CommandLineParser)
ProviderKind Gets the kind of provider that was used to determine the available arguments.
(Inherited from CommandLineParser)
StringProvider Gets the LocalizedStringProvider implementation used to get strings for error messages and usage help.
(Inherited from CommandLineParser)
Validators Gets the class validators for the arguments class.
(Inherited from CommandLineParser)

Methods

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)
GetArgument Gets a command line argument by name or alias.
(Inherited from CommandLineParser)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetShortArgument Gets a command line argument by short name or alias.
(Inherited from CommandLineParser)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetUsage Gets a string containing command line usage help.
(Inherited from CommandLineParser)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnArgumentParsed Raises the ArgumentParsed event.
(Inherited from CommandLineParser)
OnDuplicateArgument Raises the DuplicateArgument event.
(Inherited from CommandLineParser)
Parse Parses the arguments returned by the EnvironmentGetCommandLineArgs method.
Parse(ReadOnlyMemoryString) Parses the specified command line arguments.
Parse(String) Parses the specified command line arguments.
ParseWithErrorHandling Parses the arguments returned by the EnvironmentGetCommandLineArgs method, and displays error messages and usage help if required.
ParseWithErrorHandling(ReadOnlyMemoryString) Parses the specified command line arguments, and displays error messages and usage help if required.
ParseWithErrorHandling(String) Parses the specified command line arguments and displays error messages and usage help if required.
ToStringReturns a string that represents the current object.
(Inherited from Object)
WriteUsage Writes command line usage help using the specified UsageWriter instance.
(Inherited from CommandLineParser)

Events

ArgumentParsed Event raised when an argument is parsed from the command line.
(Inherited from CommandLineParser)
DuplicateArgument Event raised when an argument that is not multi-value is specified more than once.
(Inherited from CommandLineParser)

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also