Επεξεργασία

Κοινή χρήση μέσω


System.Collections.Immutable Namespace

Contains interfaces and classes that define immutable collections.

Classes

ImmutableArray

Provides methods for creating an array that is immutable; meaning it cannot be changed once it is created.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableArray<T>.Builder

A writable array accessor that can be converted into an ImmutableArray<T> instance without allocating extra memory.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableDictionary

Provides a set of initialization methods for instances of the ImmutableDictionary<TKey,TValue> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableDictionary<TKey,TValue>.Builder

Represents a hash map that mutates with little or no memory allocations and that can produce or build on immutable hash map instances very efficiently.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableDictionary<TKey,TValue>

Represents an immutable, unordered collection of keys and values.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableHashSet

Provides a set of initialization methods for instances of the ImmutableHashSet<T> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableHashSet<T>.Builder

Represents a hash set that mutates with little or no memory allocations and that can produce or build on immutable hash set instances very efficiently.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableHashSet<T>

Represents an immutable, unordered hash set.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableInterlocked

Contains interlocked exchange mechanisms for immutable collections.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableList

Provides a set of initialization methods for instances of the ImmutableList<T> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableList<T>.Builder

Represents a list that mutates with little or no memory allocations and that can produce or build on immutable list instances very efficiently.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableList<T>

Represents an immutable list, which is a strongly typed list of objects that can be accessed by index.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableQueue

Provides a set of initialization methods for instances of the ImmutableQueue<T> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableQueue<T>

Represents an immutable queue.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedDictionary

Provides a set of initialization methods for instances of the ImmutableSortedDictionary<TKey,TValue> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedDictionary<TKey,TValue>.Builder

Represents a sorted dictionary that mutates with little or no memory allocations and that can produce or build on immutable sorted dictionary instances very efficiently.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedDictionary<TKey,TValue>

Represents an immutable sorted dictionary.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedSet

Provides a set of initialization methods for instances of the ImmutableSortedSet<T> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedSet<T>.Builder

Represents a sorted set that enables changes with little or no memory allocations, and efficiently manipulates or builds immutable sorted sets.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedSet<T>

Represents an immutable sorted set implementation.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableStack

Provides a set of initialization methods for instances of the ImmutableStack<T> class.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableStack<T>

Represents an immutable stack.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

Structs

ImmutableArray<T>.Enumerator

An array enumerator.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableArray<T>

Represents an array that is immutable; meaning it cannot be changed once it is created.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableDictionary<TKey,TValue>.Enumerator

Enumerates the contents of the immutable dictionary without allocating any memory.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableHashSet<T>.Enumerator

Enumerates the contents of the immutable hash set without allocating any memory.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableList<T>.Enumerator

Enumerates the contents of a binary tree.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableQueue<T>.Enumerator

Enumerates the contents of an immutable queue without allocating any memory.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedDictionary<TKey,TValue>.Enumerator

Enumerates the contents of a binary tree.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableSortedSet<T>.Enumerator

Enumerates the contents of a binary tree.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

ImmutableStack<T>.Enumerator

Enumerates the contents of an immutable stack without allocating any memory.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

Interfaces

IImmutableDictionary<TKey,TValue>

Represents an immutable collection of key/value pairs.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

IImmutableList<T>

Represents a list of elements that cannot be modified.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

IImmutableQueue<T>

Represents an immutable first-in, first-out collection of objects.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

IImmutableSet<T>

Represents a set of elements that can only be modified by creating a new instance of the set.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

IImmutableStack<T>

Represents an immutable last-in-first-out (LIFO) collection.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

Remarks

With immutable collections, you can:

  • Share a collection in a way that its consumer can be assured that the collection never changes.
  • Provide implicit thread safety in multi-threaded applications (no locks required to access collections).
  • Follow functional programming practices.
  • Modify a collection during enumeration, while ensuring that the original collection does not change.

The immutable collection classes are available as part of the core .NET libraries, however they're not part of the core class library distributed with .NET Framework. For .NET Framework 4.6.2 and later apps, the classes are available through NuGet packages.