C# Class CommandLine.Parser

Parser for command line arguments. The parser specification is infered from the instance fields of the object specified as the destination of the parse. Valid argument types are: int, uint, string, bool, enums Also argument types of Array of the above types are also valid. Error checking options can be controlled by adding a ArgumentAttribute to the instance fields of the destination object. At most one field may be marked with the DefaultArgumentAttribute indicating that arguments without a '-' or '/' prefix will be parsed as that argument. If not specified then the parser will infer default options for parsing each instance field. The default long name of the argument is the field name. The default short name is the first character of the long name. Long names and explicitly specified short names must be unique. Default short names will be used provided that the default short name does not conflict with a long name or an explicitly specified short name. Arguments which are array types are collection arguments. Collection arguments can be specified multiple times.
Show file Open project: ErikEJ/SqlQueryStress Class Usage Examples

Public Methods

Method Description
ParseArguments ( string args, object options ) : bool

Parses a System.String array of command line arguments, setting values read in options parameter instance.

ParseArguments ( string args, object options, TextWriter helpWriter ) : bool

Parses a System.String array of command line arguments, setting values read in options parameter instance. This overloads allows you to specify a System.IO.TextWriter derived instance for write text messages.

Method Details

ParseArguments() public static method

Parses a System.String array of command line arguments, setting values read in options parameter instance.
Thrown if is null. Thrown if is null.
public static ParseArguments ( string args, object options ) : bool
args string A array of command line arguments.
options object An instance to receive values. /// Parsing rules are defined using derived types.
return bool

ParseArguments() public static method

Parses a System.String array of command line arguments, setting values read in options parameter instance. This overloads allows you to specify a System.IO.TextWriter derived instance for write text messages.
Thrown if is null. Thrown if is null. Thrown if is null.
public static ParseArguments ( string args, object options, TextWriter helpWriter ) : bool
args string A array of command line arguments.
options object An instance to receive values. /// Parsing rules are defined using derived types.
helpWriter System.IO.TextWriter Any instance derived from , /// usually .
return bool