Mono.Options.OptionSet.GetKeyForItem Method
Returns item.GetNames()[0].

Syntax

protected override string GetKeyForItem (Option item)

Parameters

item
An Mono.Options.Option to return the key of.

Returns

A string containing the first alias returned by Option.GetNames.

Remarks

This is to support the System.Collections.ObjectModel.KeyedCollection<string, Mono.Options.Option> infrastructure. System.Collections.ObjectModel.KeyedCollection<string, Mono.Options.Option> assumes only one key per item, so we arbitrarily choose the first item in the option alias list.

Note: All aliases returned by Option.GetNames are still registered with System.Collections.ObjectModel.KeyedCollection<string, Mono.Options.Option> even though OptionSet.GetKeyForItem(Option) will never return them. Consequently, System.Collections.ObjectModel.KeyedCollection<string, Option>.Contains(`0) and System.Collections.ObjectModel.KeyedCollection<string, Option>.Item(`0) will both correctly use all aliases returned by Option.GetNames.

Requirements

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