This documentation is archived and is not being maintained.

NameObjectCollectionBase.KeysCollection.Item Property

Gets the entry at the specified index of the collection.

[C#] In C#, this property is the indexer for the NameObjectCollectionBase.KeysCollection class.

[Visual Basic]
Public Default ReadOnly Property Item( _
   ByVal index As Integer _
) As String
[C#]
public string this[
 int index
] {get;}
[C++]
public: __property String* get_Item(
 int index
);
[JScript]
returnValue = KeysCollectionObject.Item(index);
-or-
returnValue = KeysCollectionObject(index);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Arguments [JScript]

index
The zero-based index of the entry to locate in the collection.

Parameters [Visual Basic, C#, C++]

index
The zero-based index of the entry to locate in the collection.

Property Value

The String key of the entry at the specified index of the collection.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException index is outside the valid range of indexes for the collection.
NotSupportedException The collection is read-only and the operation attempts to modify the collection.

Remarks

This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[index] (In Visual Basic, myCollection(index)).

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

NameObjectCollectionBase.KeysCollection Class | NameObjectCollectionBase.KeysCollection Members | System.Collections.Specialized Namespace

Show: