CommandLineParserT Class

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

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
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 and overloads return the correct type, which avoids casting.

If you don't intend to manually handle errors and usage help printing, and don't need to inspect the state of the CommandLineParser instance, the static ParseT(String, ParseOptions) should be used instead.

Constructors

CommandLineParserT Initializes a new instance of the CommandLineParser class using the specified options.

Properties

AllowDuplicateArguments Gets a value indicating whether duplicate arguments are allowed.
(Inherited from CommandLineParser)
AllowWhiteSpaceValueSeparator Gets value indicating whether the value of an argument may be in a separate argument from its name.
(Inherited from CommandLineParser)
ApplicationFriendlyName Gets the friendly name of the application.
(Inherited from CommandLineParser)
ArgumentNameComparer Gets the string comparer 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, Int32) 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)
NameValueSeparator Gets or sets the character 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 call to the Parse(String, Int32) method.
(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.
(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 GetCommandLineArgs method.
Parse(String, Int32) Parses the specified command line arguments, starting at the specified index.
ParseWithErrorHandling Parses the arguments returned by the GetCommandLineArgs method, and displays error messages and usage help if required.
ParseWithErrorHandling(String, Int32) Parses the specified command line arguments, starting at the specified index, 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 to the specified TextWriter using the specified options.
(Inherited from CommandLineParser)

Events

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

See Also