IOrderedDictionary.Item Property (Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the element at the specified index.

Namespace:   System.Collections.Specialized
Assembly:  System (in System.dll)

abstract Item : 
        index:int -> Object with get, set

Parameters

index
Type: System.Int32

The zero-based index of the element to get or set.

Property Value

Type: System.Object

The element at the specified index.

Exception Condition
ArgumentOutOfRangeException

index is less than 0.

-or-

index is equal to or greater than Count.

IOrderedDictionary accepts null as a valid value and allows duplicate elements.

The C# language uses the keyword to define the indexers instead of implementing the Item property. Visual Basic implements Item as a default property, which provides the same indexing functionality.

This property allows you to access a specific element in the collection by using the following syntax:

No code example is currently available or this language may not be supported.

The following code example demonstrates the implementation of a simple IOrderedDictionary based on the ArrayList class. The implemented IOrderedDictionary stores first names as the keys and last names as the values, with the added requirement that each first name is unique. This code is part of a larger code example provided for the IOrderedDictionary class.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top
Show: