Contract.Exists Metod

Definition

Överlagringar

Name Description
Exists(Int32, Int32, Predicate<Int32>)

Avgör om ett angivet test är sant för alla heltal inom ett heltalsintervall.

Exists<T>(IEnumerable<T>, Predicate<T>)

Avgör om ett element i en samling element finns i en funktion.

Exists(Int32, Int32, Predicate<Int32>)

Avgör om ett angivet test är sant för alla heltal inom ett heltalsintervall.

public:
 static bool Exists(int fromInclusive, int toExclusive, Predicate<int> ^ predicate);
public static bool Exists(int fromInclusive, int toExclusive, Predicate<int> predicate);
static member Exists : int * int * Predicate<int> -> bool
Public Shared Function Exists (fromInclusive As Integer, toExclusive As Integer, predicate As Predicate(Of Integer)) As Boolean

Parametrar

fromInclusive
Int32

Det första heltal som ska skickas till predicate.

toExclusive
Int32

Ett fler än det sista heltal som ska skickas till predicate.

predicate
Predicate<Int32>

Funktionen som ska utvärderas för alla värden för heltalet i det angivna intervallet.

Returer

true om predicate returnerar true för alla heltal från fromInclusive till toExclusive - 1.

Undantag

predicate är null.

toExclusive är mindre än fromInclusive.

Kommentarer

Parametern toExclusive är ett fler än det sista heltalet för att underlätta användningen av längden på ett heltal med början 0. Det skulle till exempel vara inställt på 5 för heltal 0 till och med 4.

Se även

Gäller för

Exists<T>(IEnumerable<T>, Predicate<T>)

Avgör om ett element i en samling element finns i en funktion.

public:
generic <typename T>
 static bool Exists(System::Collections::Generic::IEnumerable<T> ^ collection, Predicate<T> ^ predicate);
public static bool Exists<T>(System.Collections.Generic.IEnumerable<T> collection, Predicate<T> predicate);
static member Exists : seq<'T> * Predicate<'T> -> bool
Public Shared Function Exists(Of T) (collection As IEnumerable(Of T), predicate As Predicate(Of T)) As Boolean

Typparametrar

T

Den typ som finns i collection.

Parametrar

collection
IEnumerable<T>

Samlingen som element av typen T kommer att ritas från för att skickas till predicate.

predicate
Predicate<T>

Funktionen som ska utvärderas för ett element i collection.

Returer

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

Undantag

collection eller predicate är null.

Se även

Gäller för