Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
Bevan Arps edited this page Nov 23, 2014 · 10 revisions

This library allows you to define the set of options accepted by a .NET console application by writing a driver class that contains methods that adhere to some simple conventions.

To declare the switches -h and --help, write this method:

[Description("Show help listing all available options")]
public void Help() { ... }

and to declare the parameters -u <user> and --username <user>, write this method:

[Description("Specify the username for authentication")]
public void Username(string user) { ... }

For more information on how this works, see the page on Conventions.

The design goals of this library:

  • Simple conventions that "just work"
  • Little to no dependency on the library

Breaking Changes

Between v1.0 and v2.0:

In v1 of the CommandLineProcessor, there was a new() generic type constraint and the processor took care of creating the driver instance itself. This behaviour prevented the use of a dependency injection framework. The breaking change in this release is to require your code to create the driver instance itself.

Migration

Modify this line:

var processor = new CommandLineProcessor<Driver>(args);

to instead create the Driver itself:

var processor = new CommandLineProcessor<Driver>(args, new Driver());

Clone this wiki locally