HttpConnectionOptionHeaderValueCollection.Item property

Gets or sets the element at the specified index.


public HttpConnectionOptionHeaderValue this[int index] { get; set; }

Property value

Type: HttpConnectionOptionHeaderValue

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.

If you are programming using Visual C++ component extensions (C++/CX), see GetAt and SetAt.

Requirements (Windows 10 device family)

Device family

API contract



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]



See also