Contract.Exists(Of T) Method (IEnumerable(Of T), Predicate(Of T))

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Determines whether an element within a collection of elements exists within a function.

Namespace:   System.Diagnostics.Contracts
Assembly:  mscorlib (in mscorlib.dll)

Public Shared Function Exists(Of T) (
	collection As IEnumerable(Of T),
	predicate As Predicate(Of T)
) As Boolean

Parameters

collection
Type: System.Collections.Generic.IEnumerable(Of T)

The collection from which elements of type T will be drawn to pass to predicate.

predicate
Type: System.Predicate(Of T)

The function to evaluate for an element in collection.

Return Value

Type: System.Boolean

true if and only if predicate returns true for any element of type T in collection.

Type Parameters

T

The type that is contained in collection.

Exception Condition
ArgumentNullException

collection or predicate is null.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: