liveBook · Manning

Persistent map

A persistent map is an immutable key-value collection whose updates produce new versions while preserving previous versions, typically through structural sharing.

How 2 Manning books explain it

C# Concurrency: Asynchronous and multithreaded programming

ImmutableDictionary<TKey,TValue> is a .NET generic dictionary whose contents cannot be changed after creation and whose modification methods return modified copies.

How it is used
Stores frequently changing shared data, such as e-commerce inventory, when immutable reads and coordinated replacements are useful.
How deep it goes
Explains read and copy-on-write APIs, builders, variable synchronization, and compare-and-retry updates, while deferring implementation internals.
Examples
Demonstrates book inventory purchases, SetItem-based copies, and an ImmutableInterlocked.TryUpdate retry loop.
What you can do after
Apply ImmutableDictionary APIs and diagnose unsafe shared-variable updates by switching compound modifications to ImmutableInterlocked.

Read how C# Concurrency: Asynchronous and multithreaded programming explains persistent map →

Fabulous Adventures in Data Structures and Algorithms

ImmutableDictionary is a .NET immutable key-value collection type that preserves prior versions when updated.

How it is used
Represents graph adjacency and can provide immutable arguments for memoized substitution operations.
How deep it goes
Describes a .NET map and its multivalue wrapper, including operations and stated O(1) costs, but not the collection's internals.
Examples
Uses node-to-neighbor mappings and a C# wrapper that associates keys with immutable sets of values.
What you can do after
Build a multivalue map by wrapping .NET's ImmutableDictionary with immutable sets and add, remove, and lookup operations.

Read how Fabulous Adventures in Data Structures and Algorithms explains persistent map →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.