ImmutableArray<T> 结构

定义

表示不可变的数组;这意味着,该数组在创建后不可更改。Represents an array that is immutable; meaning it cannot be changed once it is created.

NuGet package: System.Collections.Immutable关于不可变集合和安装方法NuGet package: System.Collections.Immutable (about immutable collections and how to install)

generic <typename T>
public value class ImmutableArray : IEquatable<System::Collections::Immutable::ImmutableArray<T>>, System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IList<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::IReadOnlyList<T>, System::Collections::IList, System::Collections::Immutable::IImmutableList<T>, System::Collections::IStructuralComparable, System::Collections::IStructuralEquatable
public struct ImmutableArray<T> : IEquatable<System.Collections.Immutable.ImmutableArray<T>>, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.IList, System.Collections.Immutable.IImmutableList<T>, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable
type ImmutableArray<'T> = struct
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
    interface ICollection
    interface IList
    interface IImmutableList<'T>
Public Structure ImmutableArray(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IEquatable(Of ImmutableArray(Of T)), IImmutableList(Of T), IList, IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T), IStructuralComparable, IStructuralEquatable

类型参数

T

数组存储的元素的类型。The type of element stored by the array.

继承
ImmutableArray<T>
实现

注解

最适用于 ImmutableArray<T> 和其他方案的情况最适合 ImmutableList<T>There are different scenarios best for ImmutableArray<T> and others best for ImmutableList<T>.

使用不可变数组的原因:Reasons to use immutable array:

  • 很少更新数据或元素数非常小(少于16项)Updating the data is rare or the number of elements is quite small (less than 16 items)

  • 你需要能够循环访问性能关键部分中的数据You need to be able to iterate over the data in performance critical sections

  • 具有多个不可变集合的实例,并且不能承受将数据保留在树中You have many instances of immutable collections and you can't afford keeping the data in trees

使用不可变列表的原因:Reasons to use immutable list:

  • 更新数据很常见,或者元素数不应太小Updating the data is common or the number of elements isn't expected to be small

  • 与循环访问内容相比,更新集合比循环访问内容更重要Updating the collection is more performance critical than iterating the contents

下表总结了的性能特征 ImmutableArray<T>The following table summarizes the performance characteristics of ImmutableArray<T>

操作Operation ImmutableArray<T> 复杂性ImmutableArray<T> Complexity ImmutableList<T> 复杂性ImmutableList<T> Complexity 注释Comments
Item O(1)O(1) O (log n)O(log n) 直接为基础数组建立索引Directly index into the underlying array
Add()Add() O(n)O(n) O (log n)O(log n) 需要创建新数组Requires creating a new array

字段

Empty

获取空的不可变数组。Gets an empty immutable array.

属性

IsDefault

获取一个值,该值指示此数组是否已声明但未初始化。Gets a value indicating whether this array was declared but not initialized.

IsDefaultOrEmpty

获取一个值,该值指示此 ImmutableArray<T> 是否为空或未初始化。Gets a value indicating whether this ImmutableArray<T> is empty or is not initialized.

IsEmpty

获取一个值,该值指示此 ImmutableArray<T> 是否为空。Gets a value indicating whether this ImmutableArray<T> is empty.

Item[Int32]

获取位于不可变数组中指定索引处的元素。Gets the element at the specified index in the immutable array.

Length

获取数组中的元素数。Gets the number of elements in the array.

方法

Add(T)

返回末尾添加了指定项的原始数组的副本。Returns a copy of the original array with the specified item added to the end.

AddRange(IEnumerable<T>)

返回原始数组的副本,该数组的末尾添加了指定项。Returns a copy of the original array with the specified elements added to the end of the array.

AddRange(ImmutableArray<T>)

返回原始数组的副本,该数组的末尾添加了指定项。Returns a copy of the original array with the specified elements added to the end of the array.

As<TOther>()

返回一个新的不可变数组,其中包含此数组的已转换成不同类型的元素。Returns a new immutable array that contains the elements of this array cast to a different type.

AsMemory()

通过此不可变数组创建新的只读内存区域。Creates a new read-only memory region over this immutable array.

AsSpan()

通过此不可变数组创建新的只读范围。Creates a new read-only span over this immutable array.

CastArray<TOther>()

通过将基础数组转换为 ImmutableArray<T> 类型的数组,初始化 TOther 结构的新实例。Initializes a new instance of the ImmutableArray<T> struct by casting the underlying array to an array of type TOther.

CastUp<TDerived>(ImmutableArray<TDerived>)

基于现有实例的内容,初始化 ImmutableArray<T> 结构的新实例,允许协变静态转换,以便高效重用现有数组。Initializes a new instance of the ImmutableArray<T> struct based on the contents of an existing instance, allowing a covariant static cast to efficiently reuse the existing array.

Clear()

返回已移除所有元素的数组。Returns an array with all the elements removed.

Contains(T)

确定指定的项是否存在于数组中。Determines whether the specified item exists in the array.

CopyTo(Int32, T[], Int32, Int32)

将此数组中的指定项复制到指定数组中的指定起始索引处。Copies the specified items in this array to the specified array at the specified starting index.

CopyTo(T[])

将此数组的内容复制到指定的数组。Copies the contents of this array to the specified array.

CopyTo(T[], Int32)

从指定目标索引处开始,将此数组的内容复制到指定的数组。Copies the contents of this array to the specified array starting at the specified destination index.

Equals(ImmutableArray<T>)

指示指定的数组是否等于此数组。Indicates whether specified array is equal to this array.

Equals(Object)

确定此数组是否等于指定的对象。Determines if this array is equal to the specified object.

GetEnumerator()

返回循环访问数组内容的枚举器。Returns an enumerator that iterates through the contents of the array.

GetHashCode()

返回此实例的哈希代码。Returns a hash code for this instance.

IndexOf(T)

搜索指定项的数组。Searches the array for the specified item.

IndexOf(T, Int32)

搜索指定项的数组。Searches the array for the specified item.

IndexOf(T, Int32, IEqualityComparer<T>)

搜索指定项的数组。Searches the array for the specified item.

IndexOf(T, Int32, Int32)

搜索指定项的数组。Searches the array for the specified item.

IndexOf(T, Int32, Int32, IEqualityComparer<T>)

搜索指定项的数组。Searches the array for the specified item.

Insert(Int32, T)

返回一个新数组,指定的值已插入到该数组的指定位置。Returns a new array with the specified value inserted at the specified position.

InsertRange(Int32, IEnumerable<T>)

在指定索引处插入指定的值。Inserts the specified values at the specified index.

InsertRange(Int32, ImmutableArray<T>)

在指定索引处插入指定的值。Inserts the specified values at the specified index.

ItemRef(Int32)

获取对位于只读列表中指定 index 处的元素的只读索引。Gets a read-only reference to the element at the specified index in the read-only list.

LastIndexOf(T)

搜索指定项的数组;从该数组的末尾处开始。Searches the array for the specified item; starting at the end of the array.

LastIndexOf(T, Int32)

搜索指定项的数组;从该数组的末尾处开始。Searches the array for the specified item; starting at the end of the array.

LastIndexOf(T, Int32, Int32)

搜索指定项的数组;从该数组的末尾处开始。Searches the array for the specified item; starting at the end of the array.

LastIndexOf(T, Int32, Int32, IEqualityComparer<T>)

搜索指定项的数组;从该数组的末尾处开始。Searches the array for the specified item; starting at the end of the array.

OfType<TResult>()

筛选此数组的元素,以仅显示可分配给指定类型的元素。Filters the elements of this array to those assignable to the specified type.

Remove(T)

返回一个数组,其中包含已从数组中移除的指定元素的第一个匹配项。Returns an array with the first occurrence of the specified element removed from the array. 如果未找到匹配项,则返回当前的数组。If no match is found, the current array is returned.

Remove(T, IEqualityComparer<T>)

返回一个数组,其中包含已从数组中移除的指定元素的第一个匹配项。Returns an array with the first occurrence of the specified element removed from the array.

如果未找到匹配项,则返回当前的数组。If no match is found, the current array is returned.

RemoveAll(Predicate<T>)

从数组中移除满足指定条件的所有项。Removes all the items from the array that meet the specified condition.

RemoveAt(Int32)

返回一个数组,其中位于指定位置的元素已被移除。Returns an array with the element at the specified position removed.

RemoveRange(IEnumerable<T>)

从此数组中移除指定的项。Removes the specified items from this array.

RemoveRange(IEnumerable<T>, IEqualityComparer<T>)

从此数组中移除指定的项。Removes the specified items from this array.

RemoveRange(ImmutableArray<T>)

从此列表中移除指定的值。Removes the specified values from this list.

RemoveRange(ImmutableArray<T>, IEqualityComparer<T>)

从此列表中移除指定的项。Removes the specified items from this list.

RemoveRange(Int32, Int32)

返回一个数组,其中位于指定位置的元素已被移除。Returns an array with the elements at the specified position removed.

Replace(T, T)

查找数组中与指定值相等的第一个元素,并将该值替换为指定的新值。Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

Replace(T, T, IEqualityComparer<T>)

查找数组中与指定值相等的第一个元素,并将该值替换为指定的新值。Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

SetItem(Int32, T)

使用指定项替换指定索引处的项。Replaces the item at the specified index with the specified item.

Sort()

使用默认比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the default comparer.

Sort(Comparison<T>)

使用指定的 ImmutableArray<T>,对整个 Comparison<T> 中的元素进行排序。Sorts the elements in the entire ImmutableArray<T> using the specified Comparison<T>.

Sort(IComparer<T>)

使用指定的比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the specified comparer.

Sort(Int32, Int32, IComparer<T>)

使用指定的比较器对不可变数组中的指定元素进行排序。Sorts the specified elements in the immutable array using the specified comparer.

ToBuilder()

创建一个其内容与此数组相同,并且可使用标准可变接口在多个操作之间有效转变的不可变数组。Creates a mutable array that has the same contents as this array and can be efficiently mutated across multiple operations using standard mutable interfaces.

运算符

Equality(ImmutableArray<T>, ImmutableArray<T>)

返回一个值,该值指示两个数组是否相等。Returns a value that indicates if two arrays are equal.

Equality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>)

返回一个值,该值指示两个数组是否相等。Returns a value that indicates if two arrays are equal.

Inequality(ImmutableArray<T>, ImmutableArray<T>)

返回一个值,该值指示两个数组是否不相等。Returns a value that indicates whether two arrays are not equal.

Inequality(Nullable<ImmutableArray<T>>, Nullable<ImmutableArray<T>>)

检查两个数组是否不相等。Checks for inequality between two array.

显式接口实现

ICollection.CopyTo(Array, Int32)

从指定的索引开始,将此数组复制到另一个数组。Copies this array to another array starting at the specified index.

ICollection.Count

获取数组的大小。Gets the size of the array.

ICollection.IsSynchronized

请参阅 ICollection 接口。See the ICollection interface.

ICollection.SyncRoot

获取同步根目录。Gets the sync root.

ICollection<T>.Add(T)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

ICollection<T>.Clear()

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

ICollection<T>.Count

获取集合中的数组数。Gets the number of array in the collection.

ICollection<T>.IsReadOnly

获取一个值,该值指示此实例是否为只读。Gets a value indicating whether this instance is read only.

ICollection<T>.Remove(T)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IEnumerable.GetEnumerator()

返回一个循环访问不可变数组的枚举器。Returns an enumerator that iterates through the immutable array.

IEnumerable<T>.GetEnumerator()

返回循环访问数组的枚举器。Returns an enumerator that iterates through the array.

IImmutableList<T>.Add(T)

返回末尾添加了指定项的原始数组的副本。Returns a copy of the original array with the specified item added to the end.

IImmutableList<T>.AddRange(IEnumerable<T>)

返回原始数组的副本,该数组的末尾添加了指定项。Returns a copy of the original array with the specified elements added to the end of the array.

IImmutableList<T>.Clear()

返回已移除所有元素的数组。Returns an array with all the elements removed.

IImmutableList<T>.Insert(Int32, T)

返回一个新数组,指定的值已插入到该数组的指定位置。Returns a new array with the specified value inserted at the specified position.

IImmutableList<T>.InsertRange(Int32, IEnumerable<T>)

在指定索引处插入指定的值。Inserts the specified values at the specified index.

IImmutableList<T>.Remove(T, IEqualityComparer<T>)

返回一个数组,其中包含已从数组中移除的指定元素的第一个匹配项;如果未找到匹配项,则返回当前数组。Returns an array with the first occurrence of the specified element removed from the array; if no match is found, the current array is returned.

IImmutableList<T>.RemoveAll(Predicate<T>)

从数组中移除满足指定条件的所有项。Removes all the items from the array that meet the specified condition.

IImmutableList<T>.RemoveAt(Int32)

返回一个数组,其中位于指定位置的元素已被移除。Returns an array with the element at the specified position removed.

IImmutableList<T>.RemoveRange(IEnumerable<T>, IEqualityComparer<T>)

从此数组中移除指定的项。Removes the specified items from this array.

IImmutableList<T>.RemoveRange(Int32, Int32)

返回一个数组,其中位于指定位置的元素已被移除。Returns an array with the elements at the specified position removed.

IImmutableList<T>.Replace(T, T, IEqualityComparer<T>)

查找数组中与指定值相等的第一个元素,并将该值替换为指定的新值。Finds the first element in the array equal to the specified value and replaces the value with the specified new value.

IImmutableList<T>.SetItem(Int32, T)

使用指定项替换指定索引处的项。Replaces the item at the specified index with the specified item.

IList.Add(Object)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList.Clear()

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList.Contains(Object)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList.IndexOf(Object)

获取位于指定索引处的值。Gets the value at the specified index.

IList.Insert(Int32, Object)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList.IsFixedSize

获取一个值,该值指示此实例是否为固定大小。Gets a value indicating whether this instance is fixed size.

IList.IsReadOnly

获取一个值,该值指示此实例是否为只读。Gets a value indicating whether this instance is read only.

IList.Item[Int32]

在指定的索引中获取或设置 ObjectGets or sets the Object at the specified index.

IList.Remove(Object)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList.RemoveAt(Int32)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList<T>.Insert(Int32, T)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IList<T>.Item[Int32]

获取或设置位于只读列表中指定索引处的元素。Gets or sets the element at the specified index in the read-only list.

IList<T>.RemoveAt(Int32)

在所有情况下均引发 NotSupportedExceptionThrows NotSupportedException in all cases.

IReadOnlyCollection<T>.Count

获取集合中的数组数。Gets the number of array in the collection.

IReadOnlyList<T>.Item[Int32]

获取指定索引处的元素。Gets the element at the specified index.

IStructuralComparable.CompareTo(Object, IComparer)

确定当前集合元素在排序顺序中的位置是位于另一个元素之前、之后还是与其位置相同。Determines whether the current collection element precedes, occurs in the same position as, or follows another element in the sort order.

IStructuralEquatable.Equals(Object, IEqualityComparer)

确定此数组在结构上是否等于指定的数组。Determines whether this array is structurally equal to the specified array.

IStructuralEquatable.GetHashCode(IEqualityComparer)

返回当前实例的哈希代码。Returns a hash code for the current instance.

扩展方法

BinarySearch<T>(ImmutableArray<T>, T)

使用默认比较器在已排序的数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。Searches the sorted immutable array for a specified element using the default comparer and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, T, IComparer<T>)

在已排序的不可变数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T)

在已排序的不可变数组中搜索指定的元素,如果已找到,则返回该元素的从零开始的索引。Searches a sorted immutable array for a specified element and returns the zero-based index of the element, if it's found.

BinarySearch<T>(ImmutableArray<T>, Int32, Int32, T, IComparer<T>)

在已排序的不可变数组中搜索指定的元素,并返回该元素的从零开始的索引。Searches a sorted immutable array for a specified element and returns the zero-based index of the element.

ToImmutableArray<TSource>(IEnumerable<TSource>)

从指定的集合创建一个不可变数组。Creates an immutable array from the specified collection.

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

通过向源键应用转换函数,从现有元素集合构造一个不可变字典。Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

基于对序列进行某种形式的转换来构造一个不可变字典。Constructs an immutable dictionary based on some transformation of a sequence.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

枚举并转换序列,然后生成其内容的不可变字典。Enumerates and transforms a sequence, and produces an immutable dictionary of its contents.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)

枚举并转换序列,然后使用指定的键比较器生成其内容的不可变字典。Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer.

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)

枚举并转换序列,然后使用指定的键和值比较器生成其内容的不可变字典。Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers.

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

枚举序列,并生成其内容的不可变哈希集。Enumerates a sequence and produces an immutable hash set of its contents.

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

枚举序列,生成其内容的不可变哈希集,并为集类型使用指定的相等性比较器。Enumerates a sequence, produces an immutable hash set of its contents, and uses the specified equality comparer for the set type.

IndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.

IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>)

搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.

IndexOf<T>(IImmutableList<T>, T, Int32)

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

IndexOf<T>(IImmutableList<T>, T, Int32, Int32)

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.

LastIndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

LastIndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>)

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

LastIndexOf<T>(IImmutableList<T>, T, Int32)

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

LastIndexOf<T>(IImmutableList<T>, T, Int32, Int32)

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

Remove<T>(IImmutableList<T>, T)

从此列表中移除指定的值。Removes the specified value from this list.

RemoveRange<T>(IImmutableList<T>, IEnumerable<T>)

从此列表中移除指定的值。Removes the specified values from this list.

Replace<T>(IImmutableList<T>, T, T)

将列表中第一个相等的元素替换为指定的元素。Replaces the first equal element in the list with the specified element.

ToImmutableList<TSource>(IEnumerable<TSource>)

枚举序列,并生成其内容的不可变列表。Enumerates a sequence and produces an immutable list of its contents.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

枚举并转换序列,然后生成其内容的不可变排序字典。Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>)

枚举并转换序列,然后使用指定的键比较器生成其内容的不可变排序字典。Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key comparer.

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>, IEqualityComparer<TValue>)

枚举并转换序列,然后使用指定的键和值比较器生成其内容的不可变排序字典。Enumerates and transforms a sequence, and produces an immutable sorted dictionary of its contents by using the specified key and value comparers.

ToImmutableSortedSet<TSource>(IEnumerable<TSource>)

枚举序列,并生成其内容的不可变排序集。Enumerates a sequence and produces an immutable sorted set of its contents.

ToImmutableSortedSet<TSource>(IEnumerable<TSource>, IComparer<TSource>)

枚举序列,生成其内容的不可变排序集,并使用指定的比较器。Enumerates a sequence, produces an immutable sorted set of its contents, and uses the specified comparer.

CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 DataTableDataRow 的输入 IEnumerable<T> 对象的情况下,返回包含 T 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 DataRowDataTable 的输入 IEnumerable<T> 对象的情况下,将 T 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 DataRowDataTable 的输入 IEnumerable<T> 对象的情况下,将 T 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Aggregate<TSource>(IEnumerable<TSource>, Func<TSource,TSource,TSource>)

对序列应用累加器函数。Applies an accumulator function over a sequence.

Aggregate<TSource,TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>)

对序列应用累加器函数。Applies an accumulator function over a sequence. 将指定的种子值用作累加器初始值。The specified seed value is used as the initial accumulator value.

Aggregate<TSource,TAccumulate,TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate,TResult>)

对序列应用累加器函数。Applies an accumulator function over a sequence. 将指定的种子值用作累加器的初始值,并使用指定的函数选择结果值。The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

All<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

确定序列中的所有元素是否都满足条件。Determines whether all elements of a sequence satisfy a condition.

Any<TSource>(IEnumerable<TSource>)

确定序列是否包含任何元素。Determines whether a sequence contains any elements.

Any<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

确定序列中是否存在任意一个元素满足条件。Determines whether any element of a sequence satisfies a condition.

Append<TSource>(IEnumerable<TSource>, TSource)

将一个值追加到序列末尾。Appends a value to the end of the sequence.

AsEnumerable<TSource>(IEnumerable<TSource>)

返回类型化为 IEnumerable<T> 的输入。Returns the input typed as IEnumerable<T>.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

计算 Decimal 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

计算 Double 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

计算 Int32 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

计算 Int64 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

计算可以为 null 的 Decimal 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

计算可以为 null 的 Double 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

计算可以为 null 的 Int32 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

计算可以为 null 的 Int64 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

计算可以为 null 的 Single 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.

Average<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

计算 Single 值序列的平均值,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

Concat<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

连接两个序列。Concatenates two sequences.

Contains<TSource>(IEnumerable<TSource>, TSource)

通过使用默认的相等比较器确定序列是否包含指定的元素。Determines whether a sequence contains a specified element by using the default equality comparer.

Contains<TSource>(IEnumerable<TSource>, TSource, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 确定序列是否包含指定的元素。Determines whether a sequence contains a specified element by using a specified IEqualityComparer<T>.

Count<TSource>(IEnumerable<TSource>)

返回序列中的元素数量。Returns the number of elements in a sequence.

Count<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回表示在指定的序列中满足条件的元素数量的数字。Returns a number that represents how many elements in the specified sequence satisfy a condition.

DefaultIfEmpty<TSource>(IEnumerable<TSource>)

返回指定序列中的元素;如果序列为空,则返回单一实例集合中的类型参数的默认值。Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.

DefaultIfEmpty<TSource>(IEnumerable<TSource>, TSource)

返回指定序列中的元素;如果序列为空,则返回单一实例集合中的指定值。Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.

Distinct<TSource>(IEnumerable<TSource>)

通过使用默认的相等比较器对值进行比较,返回序列中的非重复元素。Returns distinct elements from a sequence by using the default equality comparer to compare values.

Distinct<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 对值进行比较,返回序列中的非重复元素。Returns distinct elements from a sequence by using a specified IEqualityComparer<T> to compare values.

ElementAt<TSource>(IEnumerable<TSource>, Int32)

返回序列中指定索引处的元素。Returns the element at a specified index in a sequence.

ElementAtOrDefault<TSource>(IEnumerable<TSource>, Int32)

返回序列中指定索引处的元素;如果索引超出范围,则返回默认值。Returns the element at a specified index in a sequence or a default value if the index is out of range.

Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

通过使用默认的相等比较器对值进行比较,生成两个序列的差集。Produces the set difference of two sequences by using the default equality comparer to compare values.

Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 对值进行比较,生成两个序列的差集。Produces the set difference of two sequences by using the specified IEqualityComparer<T> to compare values.

First<TSource>(IEnumerable<TSource>)

返回序列中的第一个元素。Returns the first element of a sequence.

First<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足指定条件的第一个元素。Returns the first element in a sequence that satisfies a specified condition.

FirstOrDefault<TSource>(IEnumerable<TSource>)

返回序列中的第一个元素;如果序列中不包含任何元素,则返回默认值。Returns the first element of a sequence, or a default value if the sequence contains no elements.

FirstOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足条件的第一个元素;如果未找到这样的元素,则返回默认值。Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

根据指定的键选择器函数对序列中的元素进行分组。Groups the elements of a sequence according to a specified key selector function.

GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

根据指定的键选择器函数对序列中的元素进行分组,并使用指定的比较器对键进行比较。Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.

GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

根据指定的键选择器函数对序列中的元素进行分组,并且通过使用指定的函数对每个组中的元素进行投影。Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.

GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

根据键选择器函数对序列中的元素进行分组。Groups the elements of a sequence according to a key selector function. 通过使用比较器对键进行比较,并且通过使用指定的函数对每个组的元素进行投影。The keys are compared by using a comparer and each group's elements are projected by using a specified function.

GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>)

根据指定的键选择器函数对序列中的元素进行分组,并且从每个组及其键中创建结果值。Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.

GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>)

根据指定的键选择器函数对序列中的元素进行分组,并且从每个组及其键中创建结果值。Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. 通过使用指定的比较器对键进行比较。The keys are compared by using a specified comparer.

GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>)

根据指定的键选择器函数对序列中的元素进行分组,并且从每个组及其键中创建结果值。Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. 通过使用指定的函数对每个组的元素进行投影。The elements of each group are projected by using a specified function.

GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>, IEqualityComparer<TKey>)

根据指定的键选择器函数对序列中的元素进行分组,并且从每个组及其键中创建结果值。Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. 通过使用指定的比较器对键值进行比较,并且通过使用指定的函数对每个组的元素进行投影。Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.

GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>,TResult>)

基于键值等同性对两个序列的元素进行关联,并对结果进行分组。Correlates the elements of two sequences based on equality of keys and groups the results. 使用默认的相等比较器对键进行比较。The default equality comparer is used to compare keys.

GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>,TResult>, IEqualityComparer<TKey>)

基于键值等同性对两个序列的元素进行关联,并对结果进行分组。Correlates the elements of two sequences based on key equality and groups the results. 使用指定的 IEqualityComparer<T> 对键进行比较。A specified IEqualityComparer<T> is used to compare keys.

Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

通过使用默认的相等比较器对值进行比较,生成两个序列的交集。Produces the set intersection of two sequences by using the default equality comparer to compare values.

Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 对值进行比较,生成两个序列的交集。Produces the set intersection of two sequences by using the specified IEqualityComparer<T> to compare values.

Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>)

基于匹配键对两个序列的元素进行关联。Correlates the elements of two sequences based on matching keys. 使用默认的相等比较器对键进行比较。The default equality comparer is used to compare keys.

Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>, IEqualityComparer<TKey>)

基于匹配键对两个序列的元素进行关联。Correlates the elements of two sequences based on matching keys. 使用指定的 IEqualityComparer<T> 对键进行比较。A specified IEqualityComparer<T> is used to compare keys.

Last<TSource>(IEnumerable<TSource>)

返回序列的最后一个元素。Returns the last element of a sequence.

Last<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足指定条件的最后一个元素。Returns the last element of a sequence that satisfies a specified condition.

LastOrDefault<TSource>(IEnumerable<TSource>)

返回序列中的最后一个元素;如果序列中不包含任何元素,则返回默认值。Returns the last element of a sequence, or a default value if the sequence contains no elements.

LastOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足条件的最后一个元素;如果未找到这样的元素,则返回默认值。Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.

LongCount<TSource>(IEnumerable<TSource>)

返回表示序列中元素总数的 Int64Returns an Int64 that represents the total number of elements in a sequence.

LongCount<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回表示序列中满足条件的元素的数量的 Int64Returns an Int64 that represents how many elements in a sequence satisfy a condition.

Max<TSource>(IEnumerable<TSource>)

返回泛型序列中的最大值。Returns the maximum value in a generic sequence.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

对序列中的每个元素调用转换函数,并返回最大的 Decimal 值。Invokes a transform function on each element of a sequence and returns the maximum Decimal value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

对序列中的每个元素调用转换函数,并返回最大的 Double 值。Invokes a transform function on each element of a sequence and returns the maximum Double value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

对序列中的每个元素调用转换函数,并返回最大的 Int32 值。Invokes a transform function on each element of a sequence and returns the maximum Int32 value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

对序列中的每个元素调用转换函数,并返回最大的 Int64 值。Invokes a transform function on each element of a sequence and returns the maximum Int64 value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最大的 Decimal 值。Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最大的 Double 值。Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最大的 Int32 值。Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最大的 Int64 值。Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最大的 Single 值。Invokes a transform function on each element of a sequence and returns the maximum nullable Single value.

Max<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

对序列中的每个元素调用转换函数,并返回最大的 Single 值。Invokes a transform function on each element of a sequence and returns the maximum Single value.

Max<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

对序列中的每个元素调用转换函数,并返回最大结果值。Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.

Min<TSource>(IEnumerable<TSource>)

返回泛型序列中的最小值。Returns the minimum value in a generic sequence.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

对序列中的每个元素调用转换函数,并返回最小的 Decimal 值。Invokes a transform function on each element of a sequence and returns the minimum Decimal value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

对序列中的每个元素调用转换函数,并返回最小的 Double 值。Invokes a transform function on each element of a sequence and returns the minimum Double value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

对序列中的每个元素调用转换函数,并返回最小的 Int32 值。Invokes a transform function on each element of a sequence and returns the minimum Int32 value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

对序列中的每个元素调用转换函数,并返回最小的 Int64 值。Invokes a transform function on each element of a sequence and returns the minimum Int64 value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最小的 Decimal 值。Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最小的 Double 值。Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最小的 Int32 值。Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最小的 Int64 值。Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

对序列中的每个元素调用转换函数,并返回可以为 null 的最小的 Single 值。Invokes a transform function on each element of a sequence and returns the minimum nullable Single value.

Min<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

对序列中的每个元素调用转换函数,并返回最小的 Single 值。Invokes a transform function on each element of a sequence and returns the minimum Single value.

Min<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

对序列中的每个元素调用转换函数,并返回最小结果值。Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

根据键按升序对序列的元素进行排序。Sorts the elements of a sequence in ascending order according to a key.

OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

使用指定的比较器按升序对序列的元素进行排序。Sorts the elements of a sequence in ascending order by using a specified comparer.

OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

根据键按降序对序列的元素进行排序。Sorts the elements of a sequence in descending order according to a key.

OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

使用指定的比较器按降序对序列的元素排序。Sorts the elements of a sequence in descending order by using a specified comparer.

Prepend<TSource>(IEnumerable<TSource>, TSource)

向序列的开头添加值。Adds a value to the beginning of the sequence.

Reverse<TSource>(IEnumerable<TSource>)

反转序列中元素的顺序。Inverts the order of the elements in a sequence.

Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

将序列中的每个元素投影到新表单。Projects each element of a sequence into a new form.

Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,TResult>)

通过合并元素的索引,将序列的每个元素投影到新窗体中。Projects each element of a sequence into a new form by incorporating the element's index.

SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TResult>>)

将序列的每个元素投影到 IEnumerable<T> 并将结果序列合并为一个序列。Projects each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence.

SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TResult>>)

将序列的每个元素投影到 IEnumerable<T> 并将结果序列合并为一个序列。Projects each element of a sequence to an IEnumerable<T>, and flattens the resulting sequences into one sequence. 每个源元素的索引用于该元素的投影表。The index of each source element is used in the projected form of that element.

SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

将序列的每个元素投影到 IEnumerable<T>,并将结果序列合并为一个序列,并对其中每个元素调用结果选择器函数。Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.

SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

将序列的每个元素投影到 IEnumerable<T>,并将结果序列合并为一个序列,并对其中每个元素调用结果选择器函数。Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. 每个源元素的索引用于该元素的中间投影表。The index of each source element is used in the intermediate projected form of that element.

SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

通过使用相应类型的默认相等比较器对序列的元素进行比较,以确定两个序列是否相等。Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.

SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 来比较两个序列的元素,以确定这两个序列是否相等。Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer<T>.

Single<TSource>(IEnumerable<TSource>)

返回序列的唯一元素;如果该序列并非恰好包含一个元素,则会引发异常。Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Single<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足指定条件的唯一元素;如果有多个这样的元素存在,则会引发异常。Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

SingleOrDefault<TSource>(IEnumerable<TSource>)

返回序列中的唯一元素;如果该序列为空,则返回默认值;如果该序列包含多个元素,此方法将引发异常。Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

SingleOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

返回序列中满足指定条件的唯一元素;如果这类元素不存在,则返回默认值;如果有多个元素满足该条件,此方法将引发异常。Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

Skip<TSource>(IEnumerable<TSource>, Int32)

跳过序列中指定数量的元素,然后返回剩余的元素。Bypasses a specified number of elements in a sequence and then returns the remaining elements.

SkipLast<TSource>(IEnumerable<TSource>, Int32)

返回一个新的可枚举集合,它包含 source 中的元素,但省略了源集合中的 count 个元素。Returns a new enumerable collection that contains the elements from source with the last count elements of the source collection omitted.

SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

如果指定的条件为 true,则跳过序列中的元素,然后返回剩余的元素。Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

如果指定的条件为 true,则跳过序列中的元素,然后返回剩余的元素。Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. 将在谓词函数的逻辑中使用元素的索引。The element's index is used in the logic of the predicate function.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

计算 Decimal 值序列的总和,这些值可通过对输入序列中的每个元素调用转换函数获得。Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

计算 Double 值序列的总和,这些值可通过对输入序列中的每个元素调用转换函数获得。Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

计算 Int32 值序列的总和,这些值可通过对输入序列中的每个元素调用转换函数获得。Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

计算 Int64 值序列的总和,这些值可通过对输入序列中的每个元素调用转换函数获得。Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

计算可以为 null 的 Decimal 值序列的总和,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

计算可以为 null 的 Double 值序列的总和,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

计算可以为 null 的 Int32 值序列的总和,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

计算可以为 null 的 Int64 值序列的总和,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

计算可以为 null 的 Single 值序列的总和,这些值可通过对输入序列的每个元素调用转换函数获得。Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

计算 Single 值序列的总和,这些值可通过对输入序列中的每个元素调用转换函数获得。Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Take<TSource>(IEnumerable<TSource>, Int32)

从序列的开头返回指定数量的相邻元素。Returns a specified number of contiguous elements from the start of a sequence.

TakeLast<TSource>(IEnumerable<TSource>, Int32)

返回一个新的可枚举集合,它包含 count 中的最后 source 个元素。Returns a new enumerable collection that contains the last count elements from source.

TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

只要指定的条件为 true,就会返回序列的元素。Returns elements from a sequence as long as a specified condition is true.

TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

只要指定的条件为 true,就会返回序列的元素。Returns elements from a sequence as long as a specified condition is true. 将在谓词函数的逻辑中使用元素的索引。The element's index is used in the logic of the predicate function.

ToArray<TSource>(IEnumerable<TSource>)

IEnumerable<T> 中创建数组。Creates an array from a IEnumerable<T>.

ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

根据指定的键选择器函数,从 IEnumerable<T> 创建一个 Dictionary<TKey,TValue>Creates a Dictionary<TKey,TValue> from an IEnumerable<T> according to a specified key selector function.

ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

根据指定的键选择器函数和键比较器,从 IEnumerable<T> 创建一个 Dictionary<TKey,TValue>Creates a Dictionary<TKey,TValue> from an IEnumerable<T> according to a specified key selector function and key comparer.

ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

根据指定的键选择器和元素选择器函数,从 IEnumerable<T> 创建一个 Dictionary<TKey,TValue>Creates a Dictionary<TKey,TValue> from an IEnumerable<T> according to specified key selector and element selector functions.

ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

根据指定的键选择器函数、比较器和元素选择器函数,从 IEnumerable<T> 创建一个 Dictionary<TKey,TValue>Creates a Dictionary<TKey,TValue> from an IEnumerable<T> according to a specified key selector function, a comparer, and an element selector function.

ToHashSet<TSource>(IEnumerable<TSource>)

IEnumerable<T> 创建一个 HashSet<T>Creates a HashSet<T> from an IEnumerable<T>.

ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

使用 comparer 通过 IEnumerable<T> 创建 HashSet<T>,以用于比较键。Creates a HashSet<T> from an IEnumerable<T> using the comparer to compare keys.

ToList<TSource>(IEnumerable<TSource>)

IEnumerable<T> 创建一个 List<T>Creates a List<T> from an IEnumerable<T>.

ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

根据指定的键选择器函数,从 IEnumerable<T> 创建一个 Lookup<TKey,TElement>Creates a Lookup<TKey,TElement> from an IEnumerable<T> according to a specified key selector function.

ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

根据指定的键选择器函数和键比较器,从 IEnumerable<T> 创建一个 Lookup<TKey,TElement>Creates a Lookup<TKey,TElement> from an IEnumerable<T> according to a specified key selector function and key comparer.

ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

根据指定的键选择器和元素选择器函数,从 IEnumerable<T> 创建一个 Lookup<TKey,TElement>Creates a Lookup<TKey,TElement> from an IEnumerable<T> according to specified key selector and element selector functions.

ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

根据指定的键选择器函数、比较器和元素选择器函数,从 IEnumerable<T> 创建一个 Lookup<TKey,TElement>Creates a Lookup<TKey,TElement> from an IEnumerable<T> according to a specified key selector function, a comparer and an element selector function.

Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

通过使用默认的相等比较器,生成两个序列的并集。Produces the set union of two sequences by using the default equality comparer.

Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

通过使用指定的 IEqualityComparer<T> 生成两个序列的并集。Produces the set union of two sequences by using a specified IEqualityComparer<T>.

Where<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

基于谓词筛选值序列。Filters a sequence of values based on a predicate.

Where<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

基于谓词筛选值序列。Filters a sequence of values based on a predicate. 将在谓词函数的逻辑中使用每个元素的索引。Each element's index is used in the logic of the predicate function.

Zip<TFirst,TSecond>(IEnumerable<TFirst>, IEnumerable<TSecond>)

使用两个指定序列中的元素生成元组序列。Produces a sequence of tuples with elements from the two specified sequences.

Zip<TFirst,TSecond,TResult>(IEnumerable<TFirst>, IEnumerable<TSecond>, Func<TFirst,TSecond,TResult>)

将指定函数应用于两个序列的对应元素,以生成结果序列。Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.

Aggregate<T>(ImmutableArray<T>, Func<T,T,T>)

以累加方式向元素序列应用函数。Applies a function to a sequence of elements in a cumulative way.

Aggregate<TAccumulate,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>)

以累加方式向元素序列应用函数。Applies a function to a sequence of elements in a cumulative way.

Aggregate<TAccumulate,TResult,T>(ImmutableArray<T>, TAccumulate, Func<TAccumulate,T,TAccumulate>, Func<TAccumulate,TResult>)

以累加方式向元素序列应用函数。Applies a function to a sequence of elements in a cumulative way.

All<T>(ImmutableArray<T>, Func<T,Boolean>)

获取一个值,该值指示此数组中的所有元素是否与给定的条件匹配。Gets a value indicating whether all elements in this array match a given condition.

Any<T>(ImmutableArray<T>)

获取一个值,该值指示数组是否包含任何元素。Gets a value indicating whether the array contains any elements.

Any<T>(ImmutableArray<T>, Func<T,Boolean>)

获取一个值,该值指示数组是否包含与指定条件匹配的任何元素。Gets a value indicating whether the array contains any elements that match a specified condition.

ElementAt<T>(ImmutableArray<T>, Int32)

返回数组中指定索引处的元素。Returns the element at a specified index in the array.

ElementAtOrDefault<T>(ImmutableArray<T>, Int32)

返回序列中指定索引处的元素;如果索引超出范围,则返回默认值。Returns the element at a specified index in a sequence or a default value if the index is out of range.

First<T>(ImmutableArray<T>)

返回数组中的第一个元素。Returns the first element in an array.

First<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足指定条件的第一个元素。Returns the first element in a sequence that satisfies a specified condition.

FirstOrDefault<T>(ImmutableArray<T>)

返回序列中的第一个元素;如果序列中不包含任何元素,则返回默认值。Returns the first element of a sequence, or a default value if the sequence contains no elements.

FirstOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足条件的第一个元素;如果未找到这样的元素,则返回默认值。Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

Last<T>(ImmutableArray<T>)

返回数组的最后一个元素。Returns the last element of the array.

Last<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足指定条件的最后一个元素。Returns the last element of a sequence that satisfies a specified condition.

LastOrDefault<T>(ImmutableArray<T>)

返回序列中的最后一个元素;如果序列中不包含任何元素,则返回默认值。Returns the last element of a sequence, or a default value if the sequence contains no elements.

LastOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足条件的最后一个元素;如果未找到这样的元素,则返回默认值。Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.

Select<T,TResult>(ImmutableArray<T>, Func<T,TResult>)

将序列中的每个元素投影到新表单。Projects each element of a sequence into a new form.

SelectMany<TSource,TCollection,TResult>(ImmutableArray<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

将序列的每个元素投影到 IEnumerable<T>,并将结果序列合并为一个序列,并对其中每个元素调用结果选择器函数。Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.

SequenceEqual<TDerived,TBase>(ImmutableArray<TBase>, IEnumerable<TDerived>, IEqualityComparer<TBase>)

根据相等比较器确定两个序列是否相等。Determines whether two sequences are equal according to an equality comparer.

SequenceEqual<TDerived,TBase>(ImmutableArray<TBase>, ImmutableArray<TDerived>, IEqualityComparer<TBase>)

根据相等比较器确定两个序列是否相等。Determines whether two sequences are equal according to an equality comparer.

SequenceEqual<TDerived,TBase>(ImmutableArray<TBase>, ImmutableArray<TDerived>, Func<TBase,TBase,Boolean>)

根据相等比较器确定两个序列是否相等。Determines whether two sequences are equal according to an equality comparer.

Single<T>(ImmutableArray<T>)

返回序列的唯一元素;如果该序列并非恰好包含一个元素,则会引发异常。Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Single<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足指定条件的唯一元素;如果有多个这样的元素存在,则会引发异常。Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

SingleOrDefault<T>(ImmutableArray<T>)

返回数组中的唯一元素;如果序列为空,则返回默认值;如果序列包含多个元素,此方法将引发异常。Returns the only element of the array, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

SingleOrDefault<T>(ImmutableArray<T>, Func<T,Boolean>)

返回序列中满足指定条件的唯一元素;如果这类元素不存在,则返回默认值;如果有多个元素满足该条件,此方法将引发异常。Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

ToArray<T>(ImmutableArray<T>)

将此数组的内容复制到不可变数组。Copies the contents of this array to a mutable array.

ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>)

基于此数组的内容创建字典。Creates a dictionary based on the contents of this array.

ToDictionary<TKey,T>(ImmutableArray<T>, Func<T,TKey>, IEqualityComparer<TKey>)

基于此数组的内容创建字典。Creates a dictionary based on the contents of this array.

ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>)

基于此数组的内容创建字典。Creates a dictionary based on the contents of this array.

ToDictionary<TKey,TElement,T>(ImmutableArray<T>, Func<T,TKey>, Func<T,TElement>, IEqualityComparer<TKey>)

基于此数组的内容创建字典。Creates a dictionary based on the contents of this array.

Where<T>(ImmutableArray<T>, Func<T,Boolean>)

基于谓词筛选值序列。Filters a sequence of values based on a predicate.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsParallel<TSource>(IEnumerable<TSource>)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

AsQueryable<TElement>(IEnumerable<TElement>)

将泛型 IEnumerable<T> 转换为泛型 IQueryable<T>Converts a generic IEnumerable<T> to a generic IQueryable<T>.

Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.