Udostępnij za pośrednictwem


HashSet<T>.Contains Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Determines whether a HashSet<T> object contains the specified element.

Namespace:  System.Collections.Generic
Assembly:  System.Core (in System.Core.dll)

Syntax

'Declaration
Public Function Contains ( _
    item As T _
) As Boolean
public bool Contains(
    T item
)

Parameters

  • item
    Type: T
    The element to locate in the HashSet<T> object.

Return Value

Type: System.Boolean
true if the HashSet<T> object contains the specified element; otherwise, false.

Implements

ICollection<T>.Contains(T)

Remarks

This method is an O(1) operation.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.