Skip to main content
HttpCacheDirectiveHeaderValueCollection.Contains method

Applies to Windows and Windows Phone

Determines whether an element is in the collection.

Syntax


public bool Contains(
  HttpNameValueHeaderValue item
)

Public Function Contains(
  item As HttpNameValueHeaderValue 
) As Boolean

Parameters

item

Type: HttpNameValueHeaderValue

The item to find in the collection.

Return value

Type: System.Boolean

true if the item was found in the collection; otherwise, false.

Remarks

You can also call IndexOf to get the index of a specific item in the collection. If the element you specify doesn't exist, IndexOf returns -1, so that's another way to determine that the collection doesn't contain a given element.

If you are programming using Visual C++ component extensions (C++/CX), there is no equivalent for Contains. You should iterate through the collection by calling First, and check each item for equality against the element you are looking for.

Requirements

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
IndexOf