Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Exists Method (Int32, Int32, Predicate(Int32))

Contract.Exists Method (Int32, Int32, Predicate(Of Int32))

Determines whether a specified test is true for any integer within a range of integers.

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

'Declaration
Public Shared Function Exists ( _
	fromInclusive As Integer, _
	toExclusive As Integer, _
	predicate As Predicate(Of Integer) _
) As Boolean

Parameters

fromInclusive
Type: System.Int32

The first integer to pass to predicate.

toExclusive
Type: System.Int32

One more than the last integer to pass to predicate.

predicate
Type: System.Predicate(Of Int32)

The function to evaluate for any value of the integer in the specified range.

Return Value

Type: System.Boolean
true if predicate returns true for any integer starting from fromInclusive to toExclusive - 1.

ExceptionCondition
ArgumentNullException

predicate is Nothing.

ArgumentException

toExclusive is less than fromInclusive.

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.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft