Skip to main content

Windows Dev Center

HttpCacheDirectiveHeaderValueCollection.IndexOf method

Determines the index of a specific item in the collection.

Syntax


public int IndexOf(
  HttpNameValueHeaderValue item
)

Public Function IndexOf(
  item As HttpNameValueHeaderValue 
) As Integer

Parameters

item

Type: HttpNameValueHeaderValue

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 HttpCacheDirectiveHeaderValueCollection to get or set a value by index.

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

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

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

HttpCacheDirectiveHeaderValueCollection
Item (indexer)