Parser for command line arguments.

Namespace: MbUnit.Core.Cons.CommandLine
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 Public method  Properties Public property  Methods Public method 
 Public

 Protected
 Instance

 Static Static member
 Declared

 Inherited
 XNA Framework Only Supported by the XNA Framework

 .NET Compact Framework Only Supported by the .NET Compact Framework

 MemberDescription
Public methodCommandLineArgumentParser(Type, ErrorReporter)
Creates a new command line argument parser.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode()()()
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.)
Public methodGetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodParse(array<String>[]()[], Object)
Parses an argument list.
Public methodToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Public propertyUsage
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

Inheritance Hierarchy

System..::.Object
  MbUnit.Core.Cons.CommandLine..::.CommandLineArgumentParser

See Also