Assembly: MbUnit.Framework (in MbUnit.Framework.dll)
Syntax
| C# | Visual Basic | Visual C++ |
public class CommandLineArgumentParser
Public Class CommandLineArgumentParser
public ref class CommandLineArgumentParser
Members
| All Members | Constructors | Properties | Methods |
| Member | Description | |
|---|---|---|
| CommandLineArgumentParser(Type, ErrorReporter) |
Creates a new command line argument parser.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode()()() | Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
| GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | |
| MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Parse(array<String>[]()[], Object) |
Parses an argument list.
| |
| ToString()()() | (Inherited from Object.) | |
| Usage |
A user friendly usage string describing the command line argument syntax.
|
Remarks
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 CommandLineArgumentAttribute to the instance fields of the destination object.
At most one field may be marked with the DefaultCommandLineArgumentAttribute 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.
Command line parsing code from Peter Halam, http://www.gotdotnet.com/community/usersamples/details.aspx?sampleguid=62a0f27e-274e-4228-ba7f-bc0118ecc41e