Contract.Exists 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| Exists(Int32, Int32, Predicate<Int32>) |
确定指定测试对于整数范围内的任何整数是否为 true。 |
| Exists<T>(IEnumerable<T>, Predicate<T>) |
确定函数中是否存在元素集合中的元素。 |
Exists(Int32, Int32, Predicate<Int32>)
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
确定指定测试对于整数范围内的任何整数是否为 true。
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
参数
- fromInclusive
- Int32
要传递给 predicate的第一个整数。
- toExclusive
- Int32
要传递给 predicate的最后一个整数多一个。
返回
true如果predicate从 1 开始truefromInclusive 的任何整数返回,则为 toExclusive 1。
例外
predicate 是 null。
toExclusive 小于 fromInclusive。
注解
参数 toExclusive 是最后一个整数的一个以上,用于使用从 0 开始的整数范围的长度。 例如,对于整数 0 到 4,它将设置为 5。
另请参阅
适用于
Exists<T>(IEnumerable<T>, Predicate<T>)
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
- Source:
- Contracts.cs
确定函数中是否存在元素集合中的元素。
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
类型参数
- T
中包含的 collection类型。
参数
- collection
- IEnumerable<T>
从中绘制要传递给的类型的 T 元素的 predicate集合。
- predicate
- Predicate<T>
要计算的元素的 collection函数。
返回
例外
collection 或 predicate 为 null.