Mono.Options.OptionSet.Add Method
Registers each alias within prototype so that any options matching the aliases in prototype will be handled by action during any subsequent OptionSet.Parse(IEnumerable<string>) calls.

Syntax

public OptionSet Add (string prototype, string description, OptionAction<string, string> action)

See Also

OptionSet.Add(Option)

Parameters

prototype
A string containing all option aliases to register, an (optional) type specifier, and an (optional) value separator list; see Option(string, string, int) for details.
description
A string to be used to initialize the Option.Description property.
action
A Mono.Options.OptionAction<string, string> to invoke when an option is parsed.

Returns

The current Mono.Options.OptionSet instance. This is to permit method chaining.

Exceptions

TypeReason
ArgumentException prototype has an alias (as returned from Option.GetNames) that conflicts with a previously registered Mono.Options.Option.
ArgumentNullException

prototype is null

-or-

action is null

Remarks

Use this method when prototype should accept two values, generally a key and a value.

Note: If prototype specifies a OptionValueType.Optional option, then it's possible that both the key and the value will be null in the callback function.

Requirements

Namespace: Mono.Options
Assembly: Mono.Options (in Mono.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.2.3.0