ImmutableSortedSet<T> ImmutableSortedSet<T> ImmutableSortedSet<T> ImmutableSortedSet<T> Class

定义

表示不可变的排序集实现。Represents an immutable sorted set implementation.

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

generic <typename T>
public ref class ImmutableSortedSet sealed : 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::Generic::ISet<T>, System::Collections::IList, System::Collections::Immutable::IImmutableSet<T>
public sealed class ImmutableSortedSet<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.Generic.ISet<T>, System.Collections.IList, System.Collections.Immutable.IImmutableSet<T>
type ImmutableSortedSet<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface IReadOnlyCollection<'T>
    interface IReadOnlyList<'T>
    interface ISet<'T>
    interface ICollection
    interface IList
    interface IImmutableSet<'T>
Public NotInheritable Class ImmutableSortedSet(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IImmutableSet(Of T), IList, IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T), ISet(Of T)

类型参数

T

集内元素的类型。The type of elements in the set.

继承
ImmutableSortedSet<T>ImmutableSortedSet<T>ImmutableSortedSet<T>ImmutableSortedSet<T>
实现

注解

使用 CreateRange 方法创建使用项预填充的新的不可变排序集。Create a new immutable sorted set that is prepopulated with items by using the CreateRange method. 当使用 @no__t 的方法(例如-0 @no__t、Remove)操作不可变的集时,将生成原始排序集的副本,并返回新的不可变排序集。When you manipulate an immutable set with methods such as Add, Reverse or Remove, a copy of the original sorted set is made, manipulations applied and a new immutable sorted set is returned.

如果需要对不可变集合执行多个操作,为了提高效率,可以使用 @no__t 2 方法将 ImmutableSortedSet<T> 复制到 ImmutableSortedSet<T>.Builder,操作该集,并使用 @no__t 3 方法再次使其变得不可变。If you need to perform multiple operations on an immutable collection, to increase efficiency you can copy the ImmutableSortedSet<T> to a ImmutableSortedSet<T>.Builder, using the ToBuilder method, manipulate the set and make it immutable again using the ToImmutable method. 这不会更改原始的不可变排序集。This will not change the original immutable sorted set.

字段

Empty Empty Empty Empty

获取空的不可变排序集。Gets an empty immutable sorted set.

属性

Count Count Count Count

获取不可变排序集内的元素数。Gets the number of elements in the immutable sorted set.

IsEmpty IsEmpty IsEmpty IsEmpty

获取一个值,该值指示此不可变排序集是否为空。Gets a value that indicates whether this immutable sorted set is empty.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取不可变排序集中位于给定索引处的元素。Gets the element of the immutable sorted set at the given index.

KeyComparer KeyComparer KeyComparer KeyComparer

获取用于对不可变排序集中的键进行排序的比较器。Gets the comparer used to sort keys in the immutable sorted set.

Max Max Max Max

根据比较器的定义,获取不可变排序集内的最大值。Gets the maximum value in the immutable sorted set, as defined by the comparer.

Min Min Min Min

根据比较器的定义,获取不可变排序集内的最小值。Gets the minimum value in the immutable sorted set, as defined by the comparer.

方法

Add(T) Add(T) Add(T) Add(T)

将指定的值添加到此不可变排序集。Adds the specified value to this immutable sorted set.

Clear() Clear() Clear() Clear()

从不可变排序集内移除所有元素。Removes all elements from the immutable sorted set.

Contains(T) Contains(T) Contains(T) Contains(T)

确定此不可变排序集是否包含指定的值。Determines whether this immutable sorted set contains the specified value.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Except(IEnumerable<T>) Except(IEnumerable<T>) Except(IEnumerable<T>) Except(IEnumerable<T>)

从此不可变排序集内移除一组指定项。Removes a specified set of items from this immutable sorted set.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回一个循环访问不可变排序集的枚举器。Returns an enumerator that iterates through the immutable sorted set.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

获取指定值在此不可变排序集内的出现位置。Gets the position within this immutable sorted set that the specified value appears in.

Intersect(IEnumerable<T>) Intersect(IEnumerable<T>) Intersect(IEnumerable<T>) Intersect(IEnumerable<T>)

创建一个不可变排序集,其中包含同时存在于此集和指定集内的元素。Creates an immutable sorted set that contains elements that exist both in this set and in the specified set.

IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable<T>)

确定当前不可变排序集是否为指定集合的真(严格)子集。Determines whether the current immutable sorted set is a proper (strict) subset of the specified collection.

IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable<T>)

确定当前不可变排序集是否为指定集合的真超集。Determines whether the current immutable sorted set is a proper superset of a specified collection.

IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable<T>)

确定当前不可变排序集是否为指定集合的子集。Determines whether the current immutable sorted set is a subset of a specified collection.

IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable<T>)

确定当前不可变排序集是否为指定集合的超集。Determines whether the current immutable sorted set is a superset of a specified collection.

ItemRef(Int32) ItemRef(Int32) ItemRef(Int32) ItemRef(Int32)

获取给定 index 处的集元素的只读引用。Gets a read-only reference of the element of the set at the given index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>) Overlaps(IEnumerable<T>)

确定当前的不可变排序集和指定的集合是否共享通用元素。Determines whether the current immutable sorted set and a specified collection share common elements.

Remove(T) Remove(T) Remove(T) Remove(T)

从此不可变排序集中移除指定的值。Removes the specified value from this immutable sorted set.

Reverse() Reverse() Reverse() Reverse()

返回一个 IEnumerable<T>,它按逆序循环访问此不可变排序集。Returns an IEnumerable<T> that iterates over this immutable sorted set in reverse order.

SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>) SetEquals(IEnumerable<T>)

确定当前不可变排序集与指定的集合是否包含相同的元素。Determines whether the current immutable sorted set and the specified collection contain the same elements.

SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>) SymmetricExcept(IEnumerable<T>)

创建一个不可变排序集,其中包含存在于此集内或者给定序列内(但不同时存在于两者中)的元素。Creates an immutable sorted set that contains elements that exist either in this set or in a given sequence, but not both.

ToBuilder() ToBuilder() ToBuilder() ToBuilder()

创建一个其内容与此不可变排序集相同,并且可使用标准可变接口有效操作的集合。Creates a collection that has the same contents as this immutable sorted set that can be efficiently manipulated by using standard mutable interfaces.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
TryGetValue(T, T) TryGetValue(T, T) TryGetValue(T, T) TryGetValue(T, T)

在集内搜索给定的值,并返回所找到的相等值(如果有)。Searches the set for a given value and returns the equal value it finds, if any.

Union(IEnumerable<T>) Union(IEnumerable<T>) Union(IEnumerable<T>) Union(IEnumerable<T>)

将一组给定项添加到此不可变排序集。Adds a given set of items to this immutable sorted set.

WithComparer(IComparer<T>) WithComparer(IComparer<T>) WithComparer(IComparer<T>) WithComparer(IComparer<T>)

返回具有指定键比较器的不可变排序集。Returns the immutable sorted set that has the specified key comparer.

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

从特定的数组索引开始,将集的元素复制到一个数组中。Copies the elements of the set to an array, starting at a particular array index.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

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

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

请参阅 ICollectionSee ICollection.

ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T) ICollection<T>.Add(T)

将指定值添加到集合。Adds the specified value to the collection.

ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear() ICollection<T>.Clear()

从集合中移除所有项。Removes all the items from the collection.

ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32) ICollection<T>.CopyTo(T[], Int32)

从特定的数组索引开始,将集合的元素复制到数组中。Copies the elements of the collection to an array, starting at a particular array index.

ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly ICollection<T>.IsReadOnly

请参阅 ICollection<T> 接口。See the ICollection<T> interface.

ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T) ICollection<T>.Remove(T)

从集合中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the collection.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator() IEnumerable<T>.GetEnumerator()

返回一个循环访问集合的枚举器。Returns an enumerator that iterates through the collection.

IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T) IImmutableSet<T>.Add(T)

将指定的元素添加到此不可变集。Adds the specified element to this immutable set.

IImmutableSet<T>.Clear() IImmutableSet<T>.Clear() IImmutableSet<T>.Clear() IImmutableSet<T>.Clear()

检索排序和顺序语义与此实例相同的空不可变集。Retrieves an empty immutable set that has the same sorting and ordering semantics as this instance.

IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>) IImmutableSet<T>.Except(IEnumerable<T>)

从当前不可变集内移除指定集合中的元素。Removes the elements in the specified collection from the current immutable set.

IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>) IImmutableSet<T>.Intersect(IEnumerable<T>)

创建一个不可变集,其中包含同时存在于此集和指定集内的元素。Creates an immutable set that contains elements that exist in both this set and the specified set.

IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T) IImmutableSet<T>.Remove(T)

从此不可变集内移除指定的元素。Removes the specified element from this immutable set.

IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>) IImmutableSet<T>.SymmetricExcept(IEnumerable<T>)

创建一个不可变集,该集仅包含存在于当前集或指定集合(但不同时存在于两者中)中的元素。Creates an immutable set that contains only elements that are present either in the current set or in the specified collection, but not both.

IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>) IImmutableSet<T>.Union(IEnumerable<T>)

创建一个新的不可变集,该集包含存在于当前集或指定集合中的所有元素。Creates a new immutable set that contains all elements that are present in either the current set or in the specified collection.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

将某项添加到集内。Adds an item to the set.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

从集内中移除所有项。Removes all items from the set.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定集是否包含特定值。Determines whether the set contains a specific value.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

确定集内特定项的索引。Determines the index of a specific item in the set.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

在集内指定索引的位置插入项。Inserts an item into the set at the specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示 IList 是否具有固定大小。Gets a value that indicates whether the IList has a fixed size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

获取一个值,该值指示 ICollection<T> 是否为只读。Gets a value that indicates whether the ICollection<T> is read-only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

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

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

从集内移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the set.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

移除集内指定索引处的项。Removes the item at the specified index of the set.

IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T) IList<T>.Insert(Int32, T)

在集内指定索引的位置插入项。Inserts an item in the set at the specified index.

IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32]

请参阅 IList<T> 接口。See the IList<T> interface.

IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32) IList<T>.RemoveAt(Int32)

移除指定索引处的项。Removes the item at the specified index.

ISet<T>.Add(T) ISet<T>.Add(T) ISet<T>.Add(T) ISet<T>.Add(T)

向当前集内添加元素,并返回一个指示是否已成功添加元素的值。Adds an element to the current set and returns a value to indicate if the element was successfully added.

ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>) ISet<T>.ExceptWith(IEnumerable<T>)

从当前集内移除指定集合中的所有元素。Removes all elements in the specified collection from the current set.

ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>) ISet<T>.IntersectWith(IEnumerable<T>)

修改当前集,使该集仅包含也存在在指定集合中的元素。Modifies the current set so that it contains only elements that are also in a specified collection.

ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>) ISet<T>.SymmetricExceptWith(IEnumerable<T>)

修改当前集,使该集仅包含存在于当前集或指定集合中的元素(但不同时存在于两者中)。Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.

ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>) ISet<T>.UnionWith(IEnumerable<T>)

修改当前集,使该集包含当前集或指定集合中存在的所有元素。Modifies the current set so that it contains all elements that are present in either the current set or the specified collection.

扩展方法

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<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) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<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) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

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

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

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

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<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) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) 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>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

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

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) 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) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) 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>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) 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) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) 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>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) 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>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

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

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

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

适用于

线程安全性

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