ImmutableSortedSet<T> Class

Definition

Represents an immutable sorted set implementation.

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)

Type Parameters

T

The type of elements in the set.

Inheritance
ImmutableSortedSet<T>
Implements

Remarks

Create a new immutable sorted set that is prepopulated with items by using the CreateRange method. 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.

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.

Fields

Empty

Gets an empty immutable sorted set.

Properties

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.

Methods

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.

(Inherited from 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.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

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

Gets a read-only reference of the element of the set at the given index.

MemberwiseClone()

Creates a shallow copy of the current Object.

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

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.

(Inherited from 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.

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Copies the elements of the set to an array, starting at a particular array index.

ICollection.IsSynchronized

See the ICollection interface.

ICollection.SyncRoot

See 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

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

Gets a value that indicates whether the IList has a fixed size.

IList.IsReadOnly

Gets a value that indicates whether the ICollection<T> is read-only.

IList.Item[Int32]

Gets 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]

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.

Extension Methods

CopyToDataTable<T>(IEnumerable<T>)

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

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

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts 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. 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. 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. 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.

Applies to

Thread Safety

This type is thread safe.