ImmutableSortedSet<T> 類別

定義

代表不可變的已排序資料集實作。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>
實作

備註

建立新的不可變的已排序資料集,並使用 CreateRange 方法預先填入專案。Create a new immutable sorted set that is prepopulated with items by using the CreateRange method. 當您使用 Add 之類的方法來操作不可變的集合時,ReverseRemove,會進行已套用的操作,並傳回新的不可變排序資料集。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.

如果您需要在不可變的集合上執行多項作業,若要提高效率,您可以使用 ToBuilder 方法,將 ImmutableSortedSet<T> 複製到 ImmutableSortedSet<T>.Builder,操作該集合,並使用 ToImmutable 方法再次使其變得不變。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

取得空的不可變已排序的資料集。Gets an empty immutable sorted set.

屬性

Count

取得不可變的已排序資料集中的項目數。Gets the number of elements in the immutable sorted set.

IsEmpty

取得值,這個值表示此不可變的已排序資料集是否為空的。Gets a value that indicates whether this immutable sorted set is empty.

Item[Int32]

取得指定索引處不可變的已排序資料集的項目。Gets the element of the immutable sorted set at the given index.

KeyComparer

取得用來排序不可變的已排序資料集中索引鍵的比較子。Gets the comparer used to sort keys in the immutable sorted set.

Max

取得不可變的已排序資料集中的最大值,如比較子所定義。Gets the maximum value in the immutable sorted set, as defined by the comparer.

Min

取得不可變的已排序資料集中的最小值,如比較子所定義。Gets the minimum value in the immutable sorted set, as defined by the comparer.

方法

Add(T)

將指定的值加入至這個不可變的已排序資料集。Adds the specified value to this immutable sorted set.

Clear()

從不可變的已排序資料集中移除所有項目。Removes all elements from the immutable sorted set.

Contains(T)

判斷此不可變的已排序資料集是否包含指定的值。Determines whether this immutable sorted set contains the specified value.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Except(IEnumerable<T>)

從這個不可變的已排序資料集中移除指定的項目資料集。Removes a specified set of items from this immutable sorted set.

GetEnumerator()

傳回可逐一查看不可變的已排序資料集的列舉值。Returns an enumerator that iterates through the immutable sorted set.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(T)

取得指定的值所出現之不可變的已排序資料集內的位置。Gets the position within this immutable sorted set that the specified value appears in.

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>)

判斷目前的不可變的已排序資料集是否為指定之集合的適當 (嚴格) 子集。Determines whether the current immutable sorted set is a proper (strict) subset of the specified collection.

IsProperSupersetOf(IEnumerable<T>)

判斷目前的不可變的已排序資料集是否為指定之集合的適當超集。Determines whether the current immutable sorted set is a proper superset of a specified collection.

IsSubsetOf(IEnumerable<T>)

判斷目前的不可變的已排序資料集是否為指定之集合的子集。Determines whether the current immutable sorted set is a subset of a specified collection.

IsSupersetOf(IEnumerable<T>)

判斷目前的不可變的已排序資料集是否為指定之集合的超集。Determines whether the current immutable sorted set is a superset of a specified collection.

ItemRef(Int32)

取得位於指定 index 集合項目的唯讀參考。Gets a read-only reference of the element of the set at the given index.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
Overlaps(IEnumerable<T>)

判斷目前的不可變的已排序資料集與指定的集合是否共用通用項目。Determines whether the current immutable sorted set and a specified collection share common elements.

Remove(T)

將指定的值從這個不可變的已排序資料集移除。Removes the specified value from this immutable sorted set.

Reverse()

傳回以反向順序逐一查看此不可變的已排序資料集的 IEnumerable<T>Returns an IEnumerable<T> that iterates over this immutable sorted set in reverse order.

SetEquals(IEnumerable<T>)

判斷目前的不可變的已排序資料集和指定的集合是否包含相同項目。Determines whether the current immutable sorted set and the specified collection contain the same elements.

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()

建立與這個不可變的已排序資料集具有相同內容的集合,可使用標準的可變介面有效率地操作這個集合。Creates a collection that has the same contents as this immutable sorted set that can be efficiently manipulated by using standard mutable interfaces.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TryGetValue(T, T)

搜尋指定值的資料集,並傳回所找到的相等值 (如果有的話)。Searches the set for a given value and returns the equal value it finds, if any.

Union(IEnumerable<T>)

將項目的指定資料集加入至這個不可變的已排序資料集。Adds a given set of items to this immutable sorted set.

WithComparer(IComparer<T>)

傳回具有指定之索引鍵比較子的不可變的已排序資料集。Returns the immutable sorted set that has the specified key comparer.

明確介面實作

ICollection.CopyTo(Array, Int32)

從特定的陣列索引開始,將資料集的項目複製到陣列中。Copies the elements of the set to an array, starting at a particular array index.

ICollection.IsSynchronized

請參閱 ICollection 介面。See the ICollection interface.

ICollection.SyncRoot

請參閱 ICollectionSee ICollection.

ICollection<T>.Add(T)

將指定的值加入集合。Adds the specified value to the collection.

ICollection<T>.Clear()

從集合中移除所有項目。Removes all the items from the collection.

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> 介面。See the ICollection<T> interface.

ICollection<T>.Remove(T)

從集合中移除第一個出現的特定物件。Removes the first occurrence of a specific object from the collection.

IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through a collection.

IEnumerable<T>.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

IImmutableSet<T>.Add(T)

將指定的項目加入至這個不可變的資料集中。Adds the specified element to this immutable set.

IImmutableSet<T>.Clear()

擷取空的不可變資料集,這個資料集的排序及順序語意與這個執行個體相同。Retrieves an empty immutable set that has the same sorting and ordering semantics as this instance.

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

從目前的不可變資料集中,移除指定之集合內的項目。Removes the elements in the specified collection from the current immutable set.

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)

從這個不可變的資料集中移除指定的項目。Removes the specified element from this immutable set.

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>)

建立新的不可變資料集,其中包含在目前資料集或指定之集合中出現的所有項目。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)

將項目加入至資料集。Adds an item to the set.

IList.Clear()

將所有項目從資料集移除。Removes all items from the set.

IList.Contains(Object)

判斷資料集是否包含特定的值。Determines whether the set contains a specific value.

IList.IndexOf(Object)

判斷資料集中特定項目的索引。Determines the index of a specific item in the set.

IList.Insert(Int32, Object)

將項目插入資料集的指定索引處。Inserts an item into the set at the specified index.

IList.IsFixedSize

取得值,指出 IList 是否有固定的大小。Gets a value that indicates whether the IList has a fixed size.

IList.IsReadOnly

取得值,這個值表示 ICollection<T> 是否為唯讀。Gets a value that indicates whether the ICollection<T> is read-only.

IList.Item[Int32]

取得或設定在指定索引處的 ObjectGets or sets the Object at the specified index.

IList.Remove(Object)

從資料集中移除第一個出現的特定物件。Removes the first occurrence of a specific object from the set.

IList.RemoveAt(Int32)

移除位於資料集指定之索引處的項目。Removes the item at the specified index of the set.

IList<T>.Insert(Int32, T)

在集合中的指定索引處插入項目。Inserts an item in the set at the specified index.

IList<T>.Item[Int32]

請參閱 IList<T> 介面。See the IList<T> interface.

IList<T>.RemoveAt(Int32)

移除指定之索引處的項目。Removes the item at the specified index.

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>)

從目前的資料集中,移除指定之集合內的所有項目。Removes all elements in the specified collection from the current set.

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>)

修改目前的資料集,使其僅包含目前資料集或指定之集合 (但非兩者) 中出現的項目。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>)

修改目前的資料集,使其包含目前資料集或指定之集合中出現的所有項目。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>)

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 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)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

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.