System.Diagnostics.Contracts.Contract.ForAll Method

Determines whether a particular condition is valid for all integers in a specified range.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)]
public static bool ForAll (int fromInclusive, int toExclusive, Predicate<int> predicate)

Parameters

fromInclusive
The first integer to pass to predicate.
toExclusive
One more than the last integer to pass to predicate.
predicate
The function to evaluate for the existence of the integers in the specified range.

Returns

true if predicate returns true for all integers starting from fromInclusive to toExclusive - 1.

Remarks

The toExclusive parameter is one more than the last integer to facilitate using the length of a range of integers starting at 0. For example, it would be set to 5 for integers 0 through 4.

Requirements

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