NameObjectCollectionBase.KeysCollection.Item[Int32] NameObjectCollectionBase.KeysCollection.Item[Int32] NameObjectCollectionBase.KeysCollection.Item[Int32] NameObjectCollectionBase.KeysCollection.Item[Int32] Property


获取集合中指定索引处的项。Gets the entry at the specified index of the collection.

 property System::String ^ default[int] { System::String ^ get(int index); };
public string this[int index] { get; }
member this.Item(int) : string
Default Public ReadOnly Property Item(index As Integer) As String


Int32 Int32 Int32 Int32

要在集合中定位的项的从零开始的索引。The zero-based index of the entry to locate in the collection.


集合中指定索引处的项的 String 键。The String key of the entry at the specified index of the collection.


index 超出了集合的有效索引范围。index is outside the valid range of indexes for the collection.


此属性提供使用以下语法访问集合中的特定元素的功能:myCollection[index](在 Visual Basic 中myCollection(index), 为)。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)).

该C#语言使用this关键字来定义索引器, 而不是实现Item[Int32]属性。The C# language uses the this keyword to define the indexers instead of implementing the Item[Int32] property. Visual Basic 实现Item[Int32]默认属性, 该属性提供相同的索引功能。Visual Basic implements Item[Int32] as a default property, which provides the same indexing functionality.

检索此属性的值的运算复杂度为 O (1);设置属性也是 O (1) 操作。Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.