System.Collections.Immutable 9.0.13
About
This package provides collections that are thread safe and guaranteed to never change their contents, also known as immutable collections. Like strings, any methods that perform modifications will not change the existing instance but instead return a new instance. For efficiency reasons, the implementation uses a sharing mechanism to ensure that newly created instances share as much data as possible with the previous instance while ensuring that operations have a predictable time complexity.
The System.Collections.Immutable library is built-in as part of the shared framework in .NET Runtime. The package can be installed when you need to use it in other target frameworks.
How to Use
using System.Collections.Immutable;
// Create immutable set of strings
ImmutableHashSet<string> colors = ImmutableHashSet.Create("Red", "Green", "Blue");
// Create a new set by adding and removing items from the original set
ImmutableHashSet<string> colorsModified = colors.Remove("Red").Add("Orange");
foreach (string s in colorsModified)
{
Console.WriteLine(s);
}
/* Example output:
Blue
Green
Orange
*/
Main Types
The main types provided by this library are:
System.Collections.Immutable.ImmutableArraySystem.Collections.Immutable.ImmutableArray<T>System.Collections.Immutable.ImmutableDictionarySystem.Collections.Immutable.ImmutableDictionary<TKey,TValue>System.Collections.Immutable.ImmutableHashSetSystem.Collections.Immutable.ImmutableHashSet<T>System.Collections.Immutable.ImmutableListSystem.Collections.Immutable.ImmutableList<T>System.Collections.Immutable.ImmutableQueueSystem.Collections.Immutable.ImmutableQueue<T>System.Collections.Immutable.ImmutableSortedDictionarySystem.Collections.Immutable.ImmutableSortedDictionary<TKey,TValue>System.Collections.Immutable.ImmutableSortedSetSystem.Collections.Immutable.ImmutableSortedSet<T>System.Collections.Immutable.ImmutableStackSystem.Collections.Immutable.ImmutableStack<T>System.Collections.Frozen.FrozenDictionarySystem.Collections.Frozen.FrozenDictionary<TKey, TValue>System.Collections.Frozen.FrozenSetSystem.Collections.Frozen.FrozenSet<T>
Additional Documentation
Feedback & Contributing
System.Collections.Immutable is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on System.Collections.Immutable.
| Packages | Downloads |
|---|---|
|
Humanizer.Core
Humanizer core package that contains the library and the neutral language (English) resources
|
336 |
|
Json.More.Net
Provides extended functionality for the System.Text.Json namespace.
|
241 |
|
Microsoft.Extensions.Diagnostics.ExceptionSummarization
Lets you retrieve exception summary information.
|
216 |
|
Microsoft.Extensions.Telemetry
Provides canonical implementations of telemetry abstractions.
|
215 |
|
OpenTelemetry
OpenTelemetry .NET SDK
|
200 |
|
xunit.v3.assert
Includes the assertion library from xUnit.net (xunit.v3.assert.dll). Supports .NET Standard 2.0 and .NET 8.
|
175 |
|
Microsoft.Build.Framework
This package contains the Microsoft.Build.Framework assembly which is a common assembly used by other MSBuild assemblies.
|
171 |
|
Microsoft.Build.Tasks.Core
This package contains the Microsoft.Build.Tasks assembly which implements the commonly used tasks of MSBuild.
|
153 |
|
Microsoft.Build.Utilities.Core
This package contains the Microsoft.Build.Utilities assembly which is used to implement custom MSBuild tasks.
|
152 |
|
Microsoft.Extensions.Telemetry
Provides canonical implementations of telemetry abstractions.
|
127 |
|
Microsoft.Build.Tasks.Core
This package contains the Microsoft.Build.Tasks assembly which implements the commonly used tasks of MSBuild.
|
127 |
|
Microsoft.Build.Utilities.Core
This package contains the Microsoft.Build.Utilities assembly which is used to implement custom MSBuild tasks.
|
127 |
|
Microsoft.Extensions.Diagnostics.ExceptionSummarization
Lets you retrieve exception summary information.
|
127 |
|
Microsoft.Build.Framework
This package contains the Microsoft.Build.Framework assembly which is a common assembly used by other MSBuild assemblies.
|
127 |
|
Humanizer.Core
Humanizer core package that contains the library and the neutral language (English) resources
|
122 |
|
Json.More.Net
Provides extended functionality for the System.Text.Json namespace.
|
122 |
|
Json.More.Net
Provides extended functionality for the System.Text.Json namespace.
|
103 |
|
Microsoft.Build.Framework
This package contains the Microsoft.Build.Framework assembly which is a common assembly used by other MSBuild assemblies.
|
100 |
|
Microsoft.Build.Tasks.Core
This package contains the Microsoft.Build.Tasks assembly which implements the commonly used tasks of MSBuild.
|
100 |
|
Microsoft.Build.Utilities.Core
This package contains the Microsoft.Build.Utilities assembly which is used to implement custom MSBuild tasks.
|
100 |
.NET Framework 4.6.2
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET Standard 2.0
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)