NDesk.Options : NDesk.Options Namespace

NDesk.Options

GIT Repository

OptionContext Class

Provides additional context information about the current NDesk.Options.Option which is being parsed.

public class OptionContext

Remarks

An instance of this class is provided via the registered callback when you override the Option.OnParseComplete(OptionContext) method.

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

Members

See Also: Inherited members from object.

Public Constructors

Constructs and initializes a new instance of the NDesk.Options.OptionContext class.

Public Properties

Option Option . The NDesk.Options.Option being parsed.
OptionIndex int . The index within the options list of the last value within OptionContext.OptionValues.
OptionName string . The actual option name used.
[read-only]
OptionSet OptionSet . The NDesk.Options.OptionSet to use for message localizations.
[read-only]
OptionValues OptionValueCollection . A collection of string values to provide to OptionContext.Option.

Member Details

OptionContext Constructor

Constructs and initializes a new instance of the NDesk.Options.OptionContext class.

public OptionContext (OptionSet set)

Parameters

set
The NDesk.Options.OptionSet instance to use for message localization purposes.

Remarks

This constructor initializes the OptionContext.OptionSet property of the new instance using set.

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

Option Property

The NDesk.Options.Option being parsed.

public Option Option { set; get; }

Value

The NDesk.Options.Option being parsed.

Remarks

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

OptionIndex Property

The index within the options list of the last value within OptionContext.OptionValues.

public int OptionIndex { set; get; }

See Also

OptionSet.Parse(IEnumerable<string>)

Value

A int containing the index within the options list of the last value within OptionContext.OptionValues.

Remarks

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

OptionName Property

The actual option name used.

public string OptionName { set; get; }

Value

A string containing the actual option name used.

Remarks

A Option.Prototype can contain multiple |-delimited aliases, e.g. h|help. This property contains the actual option name specified, e.g. -h vs. --help.

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

OptionSet Property

The NDesk.Options.OptionSet to use for message localizations.

public OptionSet OptionSet { get; }

Value

The NDesk.Options.OptionSet to use for message localizations.

Remarks

This property is initialized in the OptionContext(OptionSet) constructor.

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0

OptionValues Property

A collection of string values to provide to OptionContext.Option.

public OptionValueCollection OptionValues { get; }

Value

A NDesk.Options.OptionValueCollection containing string values to provide to OptionContext.Option.

Remarks

The NDesk.Options.OptionValueCollection indexer makes use of the Option.OptionValueType and Option.MaxValueCount properties. If the index does not have a value, the index is less than Option.MaxValueCount, and the OptionContext.Option has a value type of OptionValueType.Optional, null is returned; otherwise an NDesk.Options.OptionException is thrown.

Requirements

Namespace: NDesk.Options
Assembly: NDesk.Options (in NDesk.Options.dll)
Assembly Versions: 0.2.0.0, 0.2.1.0