Gets or sets the element at the specified index.
The element at the specified index.
The Item indexer property provides the support for a collection indexer syntax in C# and Microsoft Visual Basic. The collection is zero-indexed. You specify the indexed value you want by enclosing the index number within square brackets if using C#, or parentheses if using Visual Basic.
The Item indexer property is settable, so you can use the indexer syntax to replace the value of an existing item in the collection. Setting to an existing item in the collection using the indexer syntax won't expand the collection, and the item you replace won't be in the collection anymore. If you want to expand the collection, use Insert (to add to the start or middle) or Add (to add to the end).
Using the indexer syntax with an index value that's greater than or equal to the Count value of the collection throws an exception; you can't use the indexer syntax to set to an index that doesn't exist yet.
If you don't know the index of an item in a collection, you can call IndexOf.
Minimum supported client
Minimum supported server
|Windows Server 2012 R2|
Build date: 11/16/2013