HashSet<T> 类

定义

表示一组值。

generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::ISet<T>
generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::IReadOnlySet<T>, System::Collections::Generic::ISet<T>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::Generic::ISet<T>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::ISet<T>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
generic <typename T>
public ref class HashSet : System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::ISet<T>
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlySet<T>, System.Collections.Generic.ISet<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.ISet<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public class HashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.ISet<T>
type HashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ISet<'T>
type HashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ISet<'T>
    interface IReadOnlySet<'T>
    interface IDeserializationCallback
    interface ISerializable
type HashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ISet<'T>
    interface IDeserializationCallback
    interface ISerializable
[<System.Serializable>]
type HashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface ISerializable
    interface IDeserializationCallback
[<System.Serializable>]
type HashSet<'T> = class
    interface ISerializable
    interface IDeserializationCallback
    interface ISet<'T>
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
[<System.Serializable>]
type HashSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface ISerializable
    interface IDeserializationCallback
    interface ISet<'T>
    interface IReadOnlyCollection<'T>
type HashSet<'T> = class
    interface ISet<'T>
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
Public Class HashSet(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IReadOnlyCollection(Of T), ISet(Of T)
Public Class HashSet(Of T)
Implements ICollection(Of T), IDeserializationCallback, IEnumerable(Of T), IReadOnlyCollection(Of T), IReadOnlySet(Of T), ISerializable, ISet(Of T)
Public Class HashSet(Of T)
Implements ICollection(Of T), IDeserializationCallback, IEnumerable(Of T), IReadOnlyCollection(Of T), ISerializable, ISet(Of T)
Public Class HashSet(Of T)
Implements ICollection(Of T), IDeserializationCallback, IEnumerable(Of T), ISerializable
Public Class HashSet(Of T)
Implements ICollection(Of T), IDeserializationCallback, IEnumerable(Of T), ISerializable, ISet(Of T)
Public Class HashSet(Of T)
Implements ICollection(Of T), IEnumerable(Of T), ISet(Of T)

类型参数

T

哈希集中的元素类型。

继承
HashSet<T>
属性
实现

示例

以下示例演示如何合并两个不同的集。 此示例创建两个 HashSet<T> 对象,并分别用偶数和奇数填充它们。 从包含偶数的集创建第三个 HashSet<T> 对象。 然后,该示例调用 UnionWith 方法,该方法将奇数集添加到第三组。

HashSet<int> evenNumbers = new HashSet<int>();
HashSet<int> oddNumbers = new HashSet<int>();

for (int i = 0; i < 5; i++)
{
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2);

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add((i * 2) + 1);
}

Console.Write("evenNumbers contains {0} elements: ", evenNumbers.Count);
DisplaySet(evenNumbers);

Console.Write("oddNumbers contains {0} elements: ", oddNumbers.Count);
DisplaySet(oddNumbers);

// Create a new HashSet populated with even numbers.
HashSet<int> numbers = new HashSet<int>(evenNumbers);
Console.WriteLine("numbers UnionWith oddNumbers...");
numbers.UnionWith(oddNumbers);

Console.Write("numbers contains {0} elements: ", numbers.Count);
DisplaySet(numbers);

void DisplaySet(HashSet<int> collection)
{
    Console.Write("{");
    foreach (int i in collection)
    {
        Console.Write(" {0}", i);
    }
    Console.WriteLine(" }");
}

/* This example produces output similar to the following:
* evenNumbers contains 5 elements: { 0 2 4 6 8 }
* oddNumbers contains 5 elements: { 1 3 5 7 9 }
* numbers UnionWith oddNumbers...
* numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }
*/

let displaySet (collection: HashSet<int>) =
    printf "{"

    for i in collection do
        printf $" {i}"

    printfn " }"

let evenNumbers = HashSet<int>()
let oddNumbers = HashSet<int>()

for i = 0 to 4 do
    // Populate numbers with just even numbers.
    evenNumbers.Add(i * 2) |> ignore

    // Populate oddNumbers with just odd numbers.
    oddNumbers.Add(i * 2 + 1) |> ignore

printf $"evenNumbers contains {evenNumbers.Count} elements: "
displaySet evenNumbers

printf $"oddNumbers contains {oddNumbers.Count} elements: "
displaySet oddNumbers

// Create a new HashSet populated with even numbers.
let numbers = HashSet<int> evenNumbers
printfn "numbers UnionWith oddNumbers..."
numbers.UnionWith oddNumbers

printf $"numbers contains {numbers.Count} elements: "
displaySet numbers
// This example produces output similar to the following:
//    evenNumbers contains 5 elements: { 0 2 4 6 8 }
//    oddNumbers contains 5 elements: { 1 3 5 7 9 }
//    numbers UnionWith oddNumbers...
//    numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }
Imports System.Collections.Generic

Class Program

    Shared Sub Main()

        Dim evenNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()
        Dim oddNumbers As HashSet(Of Integer) = New HashSet(Of Integer)()

        For i As Integer = 0 To 4

            ' Populate evenNumbers with only even numbers.
            evenNumbers.Add(i * 2)

            ' Populate oddNumbers with only odd numbers.
            oddNumbers.Add((i * 2) + 1)
        Next i

        Console.Write("evenNumbers contains {0} elements: ", evenNumbers.Count)
        DisplaySet(evenNumbers)

        Console.Write("oddNumbers contains {0} elements: ", oddNumbers.Count)
        DisplaySet(oddNumbers)

        ' Create a new HashSet populated with even numbers.
        Dim numbers As HashSet(Of Integer) = New HashSet(Of Integer)(evenNumbers)
        Console.WriteLine("numbers UnionWith oddNumbers...")
        numbers.UnionWith(oddNumbers)

        Console.Write("numbers contains {0} elements: ", numbers.Count)
        DisplaySet(numbers)
    End Sub


    Private Shared Sub DisplaySet(ByVal collection As HashSet(Of Integer))
        Console.Write("{")
        For Each i As Integer In collection
            Console.Write(" {0}", i)
        Next i
        Console.WriteLine(" }")
    End Sub

End Class
' This example produces output similar to the following:
' evenNumbers contains 5 elements: { 0 2 4 6 8 }
' oddNumbers contains 5 elements: { 1 3 5 7 9 }
' numbers UnionWith oddNumbers...
' numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }

注解

有关此 API 的详细信息,请参阅 HashSet <T>的补充 API 备注。

构造函数

HashSet<T>()

初始化 HashSet<T> 类的新实例,该实例为空,并为集类型使用默认相等比较器。

HashSet<T>(IEnumerable<T>)

初始化 HashSet<T> 类的新实例,该实例使用集类型的默认相等比较器,包含从指定集合复制的元素,并且有足够的容量来容纳复制的元素数。

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

初始化 HashSet<T> 类的新实例,该实例使用集类型的指定相等比较器,包含从指定集合复制的元素,并且有足够的容量来容纳复制的元素数。

HashSet<T>(IEqualityComparer<T>)

初始化 HashSet<T> 类的新实例,该实例为空,并为集类型使用指定的相等比较器。

HashSet<T>(Int32)

初始化 HashSet<T> 类的新实例,该实例为空,但为 capacity 项保留空间,并为集类型使用默认相等比较器。

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

初始化 HashSet<T> 类的新实例,该实例使用集类型的指定相等比较器,并且有足够的容量来容纳 capacity 元素。

HashSet<T>(SerializationInfo, StreamingContext)
已过时.

使用序列化的数据初始化 HashSet<T> 类的新实例。

属性

Capacity

获取内部数据结构可以保留的元素总数,而无需调整大小。

Comparer

获取用于确定集中值的相等性 IEqualityComparer<T> 对象。

Count

获取集中包含的元素数。

方法

Add(T)

将指定的元素添加到集。

Clear()

HashSet<T> 对象中删除所有元素。

Contains(T)

确定 HashSet<T> 对象是否包含指定的元素。

CopyTo(T[])

HashSet<T> 对象的元素复制到数组。

CopyTo(T[], Int32)

从指定的数组索引开始,将 HashSet<T> 对象的元素复制到数组。

CopyTo(T[], Int32, Int32)

从指定的数组索引开始,将 HashSet<T> 对象的指定元素数复制到数组。

CreateSetComparer()

返回一个 IEqualityComparer 对象,该对象可用于 HashSet<T> 对象的相等性测试。

EnsureCapacity(Int32)

确保此哈希集可以保留指定数量的元素,而无需进一步扩展其后盾存储。

Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
ExceptWith(IEnumerable<T>)

从当前 HashSet<T> 对象中删除指定集合中的所有元素。

GetEnumerator()

返回循环访问 HashSet<T> 对象的枚举数。

GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetObjectData(SerializationInfo, StreamingContext)
已过时.

实现 ISerializable 接口并返回序列化 HashSet<T> 对象所需的数据。

GetType()

获取当前实例的 Type

(继承自 Object)
IntersectWith(IEnumerable<T>)

修改当前 HashSet<T> 对象以仅包含该对象和指定集合中存在的元素。

IsProperSubsetOf(IEnumerable<T>)

确定 HashSet<T> 对象是否为指定集合的适当子集。

IsProperSupersetOf(IEnumerable<T>)

确定 HashSet<T> 对象是否为指定集合的适当超集。

IsSubsetOf(IEnumerable<T>)

确定 HashSet<T> 对象是否为指定集合的子集。

IsSupersetOf(IEnumerable<T>)

确定 HashSet<T> 对象是否为指定集合的超集。

MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
OnDeserialization(Object)

实现 ISerializable 接口,并在反序列化完成时引发反序列化事件。

Overlaps(IEnumerable<T>)

确定当前 HashSet<T> 对象和指定的集合是否共享公共元素。

Remove(T)

HashSet<T> 对象中删除指定的元素。

RemoveWhere(Predicate<T>)

HashSet<T> 集合中删除与指定谓词定义的条件匹配的所有元素。

SetEquals(IEnumerable<T>)

确定 HashSet<T> 对象和指定的集合是否包含相同的元素。

SymmetricExceptWith(IEnumerable<T>)

修改当前 HashSet<T> 对象以仅包含该对象或指定集合中存在的元素,但不包含两者。

ToString()

返回一个表示当前对象的字符串。

(继承自 Object)
TrimExcess()

HashSet<T> 对象的容量设置为它包含的实际元素数,向上舍入到附近特定于实现的值。

TrimExcess(Int32)

HashSet<T> 对象的容量设置为指定数量的条目,向上舍入到附近的特定于实现的值。

TryGetValue(T, T)

搜索集合中的给定值,并返回其查找的等值(如果有)。

UnionWith(IEnumerable<T>)

修改当前 HashSet<T> 对象,以包含本身、指定集合或两者中存在的所有元素。

显式接口实现

ICollection<T>.Add(T)

将项添加到 ICollection<T> 对象。

ICollection<T>.IsReadOnly

获取一个值,该值指示集合是否为只读。

IEnumerable.GetEnumerator()

返回循环访问集合的枚举器。

IEnumerable<T>.GetEnumerator()

返回循环访问集合的枚举器。

扩展方法

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

根据指定的键选择器函数从 IEnumerable<T> 创建 FrozenDictionary<TKey,TValue>

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

根据指定的键选择器和元素选择器函数从 IEnumerable<T> 创建 FrozenDictionary<TKey,TValue>

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

创建具有指定值的 FrozenSet<T>

ToImmutableArray<TSource>(IEnumerable<TSource>)

从指定的集合创建不可变数组。

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

从现有元素集合构造不可变字典,将转换函数应用于源键。

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

基于序列的某些转换构造不可变字典。

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

枚举和转换序列,并生成其内容的不可变字典。

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

枚举和转换序列,并使用指定的键比较器生成其内容的不可变字典。

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

枚举和转换序列,并使用指定的键和值比较器生成其内容的不可变字典。

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

枚举序列并生成其内容的不可变哈希集。

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

枚举序列,生成其内容的不可变哈希集,并为集类型使用指定的相等比较器。

ToImmutableList<TSource>(IEnumerable<TSource>)

枚举序列并生成其内容的不可变列表。

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

枚举和转换序列,并生成其内容的不可变排序字典。

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

枚举和转换序列,并使用指定的键比较器生成其内容的不可变排序字典。

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

枚举和转换序列,并使用指定的键和值比较器生成其内容的不可变排序字典。

ToImmutableSortedSet<TSource>(IEnumerable<TSource>)

枚举序列并生成其内容的不可变排序集。

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

枚举序列,生成其内容的不可变排序集,并使用指定的比较器。

CopyToDataTable<T>(IEnumerable<T>)

返回一个包含 DataRow 对象副本的 DataTable,给定 IEnumerable<T> 对象的输入 IEnumerable<T> 对象,其中泛型参数 TDataRow

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

给定泛型参数 TDataRow的输入 IEnumerable<T> 对象,将 DataRow 对象复制到指定的 DataTable

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

给定泛型参数 TDataRow的输入 IEnumerable<T> 对象,将 DataRow 对象复制到指定的 DataTable

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

对序列应用累加器函数。

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

对序列应用累加器函数。 指定的种子值用作初始累加器值。

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

对序列应用累加器函数。 指定的种子值用作初始累加器值,并且指定函数用于选择结果值。

AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>)

表示一组值。

AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, Func<TKey,TAccumulate>, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>)

表示一组值。

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

确定序列的所有元素是否满足条件。

Any<TSource>(IEnumerable<TSource>)

确定序列是否包含任何元素。

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

确定序列的任何元素是否满足条件。

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

将值追加到序列的末尾。

AsEnumerable<TSource>(IEnumerable<TSource>)

返回类型化为 IEnumerable<T>的输入。

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

计算通过对输入序列的每个元素调用转换函数获得的 Decimal 值的序列的平均值。

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

计算通过对输入序列的每个元素调用转换函数获得的 Double 值的序列的平均值。

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

计算通过对输入序列的每个元素调用转换函数获得的 Int32 值的序列的平均值。

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

计算通过对输入序列的每个元素调用转换函数获得的 Int64 值的序列的平均值。

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

计算一系列可为 null 的 Decimal 值的平均值,这些值是通过对输入序列的每个元素调用转换函数获得的。

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

计算一系列可为 null 的 Double 值的平均值,这些值是通过对输入序列的每个元素调用转换函数获得的。

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

计算一系列可为 null 的 Int32 值的平均值,这些值是通过对输入序列的每个元素调用转换函数获得的。

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

计算一系列可为 null 的 Int64 值的平均值,这些值是通过对输入序列的每个元素调用转换函数获得的。

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

计算一系列可为 null 的 Single 值的平均值,这些值是通过对输入序列的每个元素调用转换函数获得的。

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

计算通过对输入序列的每个元素调用转换函数获得的 Single 值的序列的平均值。

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定类型。

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

将序列的元素拆分为大小块,最多 size

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

连接两个序列。

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

使用默认相等比较器确定序列是否包含指定的元素。

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

确定序列是否使用指定的 IEqualityComparer<T>包含指定的元素。

Count<TSource>(IEnumerable<TSource>)

返回序列中的元素数。

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

返回一个数字,该值代表指定序列中满足条件的元素数。

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

表示一组值。

DefaultIfEmpty<TSource>(IEnumerable<TSource>)

如果序列为空,则返回指定序列的元素或类型参数在单一实例集合中的默认值。

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

如果序列为空,则返回指定序列的元素或单个实例集合中的指定值。

Distinct<TSource>(IEnumerable<TSource>)

通过使用默认相等比较器比较值,从序列中返回不同的元素。

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

通过使用指定的 IEqualityComparer<T> 来比较值,从序列中返回不同的元素。

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

根据指定的键选择器函数返回序列中的不同元素。

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

根据指定的键选择器函数并使用指定的比较器比较键,从序列中返回不同的元素。

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

返回序列中指定索引处的元素。

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

返回序列中指定索引处的元素。

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

返回序列中指定索引处的元素;如果索引范围不足,则返回默认值。

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

返回序列中指定索引处的元素;如果索引范围不足,则返回默认值。

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

使用默认相等比较器来比较值,生成两个序列的集差。

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

通过使用指定的 IEqualityComparer<T> 来比较值,生成两个序列的集差异。

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

根据指定的键选择器函数生成两个序列的集差异。

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

根据指定的键选择器函数生成两个序列的集差异。

First<TSource>(IEnumerable<TSource>)

返回序列的第一个元素。

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

返回满足指定条件的序列中的第一个元素。

FirstOrDefault<TSource>(IEnumerable<TSource>)

返回序列的第一个元素;如果序列不包含任何元素,则返回默认值。

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

返回序列的第一个元素;如果序列不包含任何元素,则返回指定的默认值。

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

返回满足条件的序列的第一个元素;如果未找到此类元素,则返回默认值。

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

返回满足条件的序列的第一个元素;如果未找到此类元素,则返回指定的默认值。

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

根据指定的键选择器函数对序列的元素进行分组。

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

根据指定的键选择器函数对序列的元素进行分组,并使用指定的比较器比较键。

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

根据指定的键选择器函数对序列的元素进行分组,并使用指定的函数投影每个组的元素。

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

根据键选择器函数对序列的元素进行分组。 通过使用比较器比较键,并且每个组的元素都通过使用指定的函数进行投影。

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

根据指定的键选择器函数对序列的元素进行分组,并从每个组及其键创建结果值。

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

根据指定的键选择器函数对序列的元素进行分组,并从每个组及其键创建结果值。 使用指定的比较器比较键。

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

根据指定的键选择器函数对序列的元素进行分组,并从每个组及其键创建结果值。 每个组的元素是使用指定的函数投影的。

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

根据指定的键选择器函数对序列的元素进行分组,并从每个组及其键创建结果值。 使用指定的比较器比较键值,并且每个组的元素都通过使用指定的函数进行投影。

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

根据键的相等性关联两个序列的元素,并对结果进行分组。 默认相等比较器用于比较键。

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

根据键相等性关联两个序列的元素,并对结果进行分组。 指定的 IEqualityComparer<T> 用于比较键。

Index<TSource>(IEnumerable<TSource>)

返回一个可枚举值,该枚举将元素的索引合并到元组中。

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

通过使用默认相等比较器来比较值,生成两个序列的集交集。

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

通过使用指定的 IEqualityComparer<T> 来比较值,生成两个序列的集交集。

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

根据指定的键选择器函数生成两个序列的集交集。

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

根据指定的键选择器函数生成两个序列的集交集。

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

根据匹配键关联两个序列的元素。 默认相等比较器用于比较键。

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

根据匹配键关联两个序列的元素。 指定的 IEqualityComparer<T> 用于比较键。

Last<TSource>(IEnumerable<TSource>)

返回序列的最后一个元素。

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

返回满足指定条件的序列的最后一个元素。

LastOrDefault<TSource>(IEnumerable<TSource>)

返回序列的最后一个元素;如果序列不包含任何元素,则返回默认值。

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

返回序列的最后一个元素;如果序列不包含任何元素,则返回指定的默认值。

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

返回满足条件的序列的最后一个元素;如果未找到此类元素,则返回默认值。

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

返回满足条件的序列的最后一个元素;如果未找到此类元素,则返回指定的默认值。

LongCount<TSource>(IEnumerable<TSource>)

返回一个表示序列中元素总数的 Int64

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

返回表示序列中满足条件的元素数的 Int64

Max<TSource>(IEnumerable<TSource>)

返回泛型序列中的最大值。

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

返回泛型序列中的最大值。

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

对序列的每个元素调用转换函数,并返回最大 Decimal 值。

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

对序列的每个元素调用转换函数,并返回最大 Double 值。

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

对序列的每个元素调用转换函数,并返回最大 Int32 值。

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

对序列的每个元素调用转换函数,并返回最大 Int64 值。

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

对序列的每个元素调用转换函数,并返回最大可为 null Decimal 值。

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

对序列的每个元素调用转换函数,并返回最大可为 null Double 值。

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

对序列的每个元素调用转换函数,并返回最大可为 null Int32 值。

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

对序列的每个元素调用转换函数,并返回最大可为 null Int64 值。

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

对序列的每个元素调用转换函数,并返回最大可为 null Single 值。

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

对序列的每个元素调用转换函数,并返回最大 Single 值。

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

对泛型序列的每个元素调用转换函数,并返回得到的最大值。

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

根据指定的键选择器函数返回泛型序列中的最大值。

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

根据指定的键选择器函数和键比较器返回泛型序列中的最大值。

Min<TSource>(IEnumerable<TSource>)

返回泛型序列中的最小值。

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

返回泛型序列中的最小值。

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

对序列的每个元素调用转换函数,并返回最小 Decimal 值。

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

对序列的每个元素调用转换函数,并返回最小 Double 值。

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

对序列的每个元素调用转换函数,并返回最小 Int32 值。

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

对序列的每个元素调用转换函数,并返回最小 Int64 值。

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

对序列的每个元素调用转换函数,并返回可为 null 的最小 Decimal 值。

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

对序列的每个元素调用转换函数,并返回可为 null 的最小 Double 值。

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

对序列的每个元素调用转换函数,并返回可为 null 的最小 Int32 值。

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

对序列的每个元素调用转换函数,并返回可为 null 的最小 Int64 值。

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

对序列的每个元素调用转换函数,并返回可为 null 的最小 Single 值。

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

对序列的每个元素调用转换函数,并返回最小 Single 值。

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

对泛型序列的每个元素调用转换函数,并返回生成的最小值。

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

根据指定的键选择器函数返回泛型序列中的最小值。

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

根据指定的键选择器函数和键比较器返回泛型序列中的最小值。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

Order<T>(IEnumerable<T>)

按升序对序列的元素进行排序。

Order<T>(IEnumerable<T>, IComparer<T>)

按升序对序列的元素进行排序。

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

根据键按升序对序列的元素进行排序。

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

使用指定的比较器按升序对序列的元素进行排序。

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

根据键按降序对序列的元素进行排序。

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

使用指定的比较器按降序对序列的元素进行排序。

OrderDescending<T>(IEnumerable<T>)

按降序对序列的元素进行排序。

OrderDescending<T>(IEnumerable<T>, IComparer<T>)

按降序对序列的元素进行排序。

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

将值添加到序列的开头。

Reverse<TSource>(IEnumerable<TSource>)

反转序列中元素的顺序。

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

将序列的每个元素投影到一个新窗体中。

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

通过合并元素的索引,将序列的每个元素投影到一个新窗体中。

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

将序列的每个元素投影到 IEnumerable<T>,并将生成的序列平展为一个序列。

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

将序列的每个元素投影到 IEnumerable<T>,并将生成的序列平展为一个序列。 每个源元素的索引用于该元素的投影形式。

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

将序列的每个元素投影到 IEnumerable<T>,将生成的序列平展为一个序列,并在其中的每个元素上调用结果选择器函数。

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

将序列的每个元素投影到 IEnumerable<T>,将生成的序列平展为一个序列,并在其中的每个元素上调用结果选择器函数。 每个源元素的索引用于该元素的中间投影形式。

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

通过使用其类型的默认相等比较器,确定两个序列是否相等。

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

通过使用指定的 IEqualityComparer<T>,确定两个序列是否相等。

Single<TSource>(IEnumerable<TSource>)

返回序列的唯一元素,如果序列中没有完全有一个元素,则会引发异常。

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

返回满足指定条件的序列的唯一元素,如果存在多个此类元素,则会引发异常。

SingleOrDefault<TSource>(IEnumerable<TSource>)

返回序列的唯一元素;如果序列为空,则返回默认值;如果序列中有多个元素,此方法将引发异常。

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

返回序列的唯一元素;如果序列为空,则返回指定的默认值;如果序列中有多个元素,此方法将引发异常。

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

返回满足指定条件的序列的唯一元素;如果没有此类元素,则返回默认值;如果多个元素满足条件,此方法将引发异常。

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

返回满足指定条件的序列的唯一元素;如果没有此类元素,则返回指定的默认值;如果多个元素满足条件,此方法将引发异常。

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

绕过序列中的指定数量的元素,然后返回其余元素。

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

返回一个新的可枚举集合,该集合包含 source 的元素,其中省略了源集合的最后一个 count 元素。

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

只要指定条件为 true,即可绕过序列中的元素,然后返回其余元素。

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

只要指定条件为 true,即可绕过序列中的元素,然后返回其余元素。 元素的索引用于谓词函数的逻辑。

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

计算通过对输入序列的每个元素调用转换函数获得的 Decimal 值序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获得的 Double 值序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获得的 Int32 值序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获得的 Int64 值序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获取的可为 null Decimal 值的序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获取的可为 null Double 值的序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获取的可为 null Int32 值的序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获取的可为 null Int64 值的序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获取的可为 null Single 值的序列的总和。

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

计算通过对输入序列的每个元素调用转换函数获得的 Single 值序列的总和。

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

从序列的开头返回指定的连续元素数。

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

返回序列中连续元素的指定范围。

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

返回一个新的可枚举集合,该集合包含来自 source的最后一个 count 元素。

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

只要指定的条件为 true,就从序列中返回元素。

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

只要指定的条件为 true,就从序列中返回元素。 元素的索引用于谓词函数的逻辑。

ToArray<TSource>(IEnumerable<TSource>)

IEnumerable<T>创建数组。

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

根据指定的键选择器函数从 IEnumerable<T> 创建 Dictionary<TKey,TValue>

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

根据指定的键选择器函数和键比较器从 IEnumerable<T> 创建 Dictionary<TKey,TValue>

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

根据指定的键选择器和元素选择器函数从 IEnumerable<T> 创建 Dictionary<TKey,TValue>

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

根据指定的键选择器函数、比较器和元素选择器函数从 IEnumerable<T> 创建 Dictionary<TKey,TValue>

ToHashSet<TSource>(IEnumerable<TSource>)

IEnumerable<T>创建 HashSet<T>

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

使用 comparer 比较键从 IEnumerable<T> 创建 HashSet<T>

ToList<TSource>(IEnumerable<TSource>)

IEnumerable<T>创建 List<T>

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

根据指定的键选择器函数从 IEnumerable<T> 创建 Lookup<TKey,TElement>

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

根据指定的键选择器函数和键比较器从 IEnumerable<T> 创建 Lookup<TKey,TElement>

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

根据指定的键选择器和元素选择器函数从 IEnumerable<T> 创建 Lookup<TKey,TElement>

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

根据指定的键选择器函数、比较器和元素选择器函数从 IEnumerable<T> 创建 Lookup<TKey,TElement>

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

尝试在不强制枚举的情况下确定序列中的元素数。

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

使用默认相等比较器生成两个序列的集并集。

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

使用指定的 IEqualityComparer<T>生成两个序列的集并集。

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

根据指定的键选择器函数生成两个序列的集并集。

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

根据指定的键选择器函数生成两个序列的集并集。

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

根据谓词筛选值序列。

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

根据谓词筛选值序列。 每个元素的索引都在谓词函数的逻辑中使用。

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

生成包含两个指定序列中的元素的元组序列。

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

生成包含三个指定序列中的元素的元组序列。

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

将指定的函数应用于两个序列的相应元素,从而生成结果序列。

AsParallel(IEnumerable)

启用查询的并行化。

AsParallel<TSource>(IEnumerable<TSource>)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

AsQueryable<TElement>(IEnumerable<TElement>)

将泛型 IEnumerable<T> 转换为泛型 IQueryable<T>

Ancestors<T>(IEnumerable<T>)

返回一个元素集合,其中包含源集合中每个节点的上级。

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

返回一个筛选的元素集合,其中包含源集合中每个节点的上级。 集合中仅包含具有匹配 XName 的元素。

DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。

Descendants<T>(IEnumerable<T>)

返回一个元素集合,其中包含源集合中每个元素和文档的子代元素。

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

返回一个筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。 集合中仅包含具有匹配 XName 的元素。

Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。

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

返回源集合中每个元素和文档的子元素的筛选集合。 集合中仅包含具有匹配 XName 的元素。

InDocumentOrder<T>(IEnumerable<T>)

返回一个节点集合,其中包含源集合中的所有节点,按文档顺序排序。

Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点的集合。

Remove<T>(IEnumerable<T>)

从源集合的父节点中删除每个节点。

适用于

另请参阅