Skip to main content
HttpExpectationHeaderValueCollection.IndexOf method

Determines the index of a specific item in the collection.

Syntax


public int IndexOf(
  HttpExpectationHeaderValue item
)

Public Function IndexOf(
  item As HttpExpectationHeaderValue 
) As Integer

Parameters

item

Type: HttpExpectationHeaderValue

The object to locate in the collection.

Return value

Type: System.Int32

The index of item if found in the collection; otherwise, –1.

Remarks

IndexOf won't throw an exception if the element specified as item doesn't exist in the collection. Instead, it will return -1, which is a special value that isn't valid as a true index.

If you have an index for an element that exists in the collection but not a reference, you can use the Item (indexer) property of HttpExpectationHeaderValueCollection to get or set a value by index.

If you are programming using Visual C++ component extensions (C++/CX) or JavaScript, see IndexOf.

Requirements (Windows 10 device family)

Device family

API contract

Namespace

Windows.Web.Http.Headers

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]

Namespace

Windows.Web.Http.Headers

See also

HttpExpectationHeaderValueCollection
Item (indexer)