Mono Class Library: System.Collections.IDictionary Overview | Members

System.Collections.IDictionary.Item Property

Gets or sets the element in the current instance that is associated with the specified key. [Edit]

This is the default property for this class.

public object this [object key] { set; get; }

Parameters

key
The key of the element to get or set. [Edit]

Value

The element with the specified key. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionkey is null. [Edit]
NotSupportedException

The property is set and the current instance is read-only.

The property is set, key does not exist in the collection, and the current instance has a fixed size.

[Edit]

Remarks

Note: This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[index].

Operation

When setting this property, if the specified key already exists in the current instance, the value is required to be replaced; otherwise, a new element is required to be created.

[Edit]

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0