ReactiveList gives you lists, dictionaries, and live views that push updates as their items change. An observable collection is a collection you can subscribe to. When code adds, edits, moves, or removes items, the collection sends each change to your subscribers and UI bindings.
Every collection is thread-safe and avoids reflection at run time, so it works with trimming and Native AOT on modern .NET.
Supported targets: net10.0, net11.0, net47, net471, net472, net48, and net481.
- Install
- Package selection
- Quick start
- Using R3
- Core concepts
- Collections
- Views
- Live queries
- Extension methods
- API overview
- Thread safety
- Performance
- Building and testing
- Core team
- Contribute
- Sponsors
Install the lean package when you do not need System.Reactive:
dotnet add package ReactiveListInstall the System.Reactive package when your app already uses Rx schedulers and operators:
dotnet add package ReactiveList.ReactiveNuGet brings in the matching runtime dependency for you:
ReactiveListreferencesReactiveUI.Primitives.ReactiveList.ReactivereferencesReactiveUI.Primitives.ReactiveandSystem.Reactive.
Upgrading from an older version? See the migration guide.
Reference one package in a project, not both. Each package uses its own root namespace and scheduling type.
A sequencer (ISequencer) decides when and on which thread work runs in ReactiveUI.Primitives. In System.Reactive, an IScheduler does the same job.
| Package | Dependency | Root namespace | Scheduler type | Use when |
|---|---|---|---|---|
ReactiveList |
ReactiveUI.Primitives |
ReactiveList.* |
ReactiveUI.Primitives.Concurrency.ISequencer |
You want standard .NET IObservable<T> with no System.Reactive dependency, or you use R3. |
ReactiveList.Reactive |
ReactiveUI.Primitives.Reactive and System.Reactive |
ReactiveList.Reactive.* |
System.Reactive.Concurrency.IScheduler |
Your app already uses System.Reactive operators and IScheduler. |
using ReactiveList;
using ReactiveList.Collections;
using ReactiveList.Core;
using ReactiveList.Queries;
using ReactiveList.Views;
using ReactiveUI.Primitives;
using ReactiveUI.Primitives.Concurrency;using System.Reactive.Concurrency;
using ReactiveList.Reactive;
using ReactiveList.Reactive.Collections;
using ReactiveList.Reactive.Core;
using ReactiveList.Reactive.Queries;
using ReactiveList.Reactive.Views;
using ReactiveUI.Primitives.Reactive;The ReactiveList.Reactive package uses the same layout under ReactiveList.Reactive.
| Namespace | Contents |
|---|---|
ReactiveList |
The ReactiveListExtensions and QuaternaryExtensions operators, such as CreateView, SortBy, GroupBy and Connect. |
ReactiveList.Collections |
The collections and their interfaces: ReactiveList<T>, Reactive2DList<T>, QuaternaryList<T>, QuaternaryDictionary<TKey, TValue>, IReactiveSource<T>, IVersionedSnapshotSource<T>, ReactiveSourceOptions and NotificationDeferral. |
ReactiveList.Core |
Notification types and helpers: CacheNotify<T>, CacheAction, Change<T>, ChangeSet<T>, PooledBatch<T>, ReactiveGroup<TKey, T>, SecondaryIndex<T, TKey> and CacheNotifyExtensions. |
ReactiveList.Views |
The view types, such as FilteredReactiveView<T>, SortedReactiveView<T> and GroupedReactiveView<T, TKey>. |
ReactiveList.Queries |
Live queries: the Live property, LiveQuery<T>, LiveView<T> and LiveGroupView<TKey, T>. |
using ReactiveList.Collections;
using ReactiveList.Core;
using ReactiveUI.Primitives;
using var orders = new ReactiveList<Order>();
using var subscription = orders.Stream.Subscribe(notification =>
{
if (notification.Action == CacheAction.Added && notification.Item is not null)
{
Console.WriteLine($"Added order {notification.Item.Id}");
}
});
orders.Add(new Order(1, 125.00m));
orders.AddRange([new Order(2, 40.00m), new Order(3, 75.00m)]);
public sealed record Order(int Id, decimal Amount);using System.Reactive.Concurrency;
using ReactiveList.Reactive;
using ReactiveList.Reactive.Collections;
using ReactiveList.Reactive.Core;
using var orders = new ReactiveList<Order>();
using var subscription = orders.Stream.Subscribe(notification =>
{
if (notification.Action == CacheAction.Added && notification.Item is not null)
{
Console.WriteLine($"Added order {notification.Item.Id}");
}
});
orders.Add(new Order(1, 125.00m));
using var view = orders.CreateView(ImmediateScheduler.Instance, throttleMs: 0);
public sealed record Order(int Id, decimal Amount);Edit groups multiple list changes into one transaction and sends a single batch notification when your callback finishes.
using ReactiveList.Collections;
using var list = new ReactiveList<string>();
list.Edit(editor =>
{
editor.Add("alpha");
editor.Add("beta");
editor.Insert(1, "middle");
_ = editor.Remove("alpha");
});ReactiveList does not require R3. When your project references both ReactiveList and R3, add the ReactiveUI.Primitives R3 bridge generator to convert streams at your application boundary:
dotnet add package ReactiveList
dotnet add package R3
dotnet add package ReactiveUI.Primitives.R3Bridge.GeneratorImport ReactiveUI.Primitives.R3Bridge to convert between IObservable<T> and R3.Observable<T>:
using ReactiveList;
using ReactiveList.Collections;
using ReactiveUI.Primitives.Concurrency;
using ReactiveUI.Primitives.R3Bridge;
using var list = new ReactiveList<Product>();
// Convert the collection stream to an R3 Observable.
R3.Observable<ReactiveList.Core.CacheNotify<Product>> r3Stream = list.Stream.AsR3Observable();
// Convert an R3 filter stream to an IObservable<Func<Product, bool>> for a live view.
R3.Observable<Func<Product, bool>> r3Filter = R3.Observable.Return<Func<Product, bool>>(p => p.IsActive);
using var view = list.CreateView(r3Filter.AsPrimitivesSignal(), Sequencer.Immediate, throttleMs: 0);
public sealed record Product(string Name, bool IsActive);Convert streams once at the edge of a module and keep the inner pipeline in one reactive model.
Every collection exposes a Stream property:
IObservable<CacheNotify<T>> Stream { get; }You subscribe to Stream, and the collection pushes a CacheNotify<T> value each time its contents change.
A cache notification (CacheNotify<T>) describes one change to a collection. A pooled batch (PooledBatch<T>) rents an array from ArrayPool<T> so large adds and removals avoid extra heap allocations.
| Member | Meaning |
|---|---|
Action |
The CacheAction that occurred (Added, Removed, Updated, Moved, Refreshed, Cleared, BatchOperation, BatchAdded, BatchRemoved, or Reset). Reset means the contents were replaced as a whole: it is raised when a deferral ends with changes, and on VersionedStream after a replace, an edit, a silent clear or a removal by predicate. A Reset without a snapshot tells the consumer to copy the source again. |
Item |
The affected item for single-item operations. |
Batch |
The PooledBatch<T> for batch operations. Call AutoDisposeBatches() or dispose the batch after reading it. |
CurrentIndex |
The item's new index, or -1 when no index applies. |
PreviousIndex |
The item's old index for move operations, or -1 when not applicable. |
Previous |
The replaced item for update operations. |
A change set (ChangeSet<T>) is a read-only list of Change<T> entries for step-by-step diff processing. Call ToChangeSets() on Stream or Connect() on a collection to receive change sets.
Each Change<T> carries a ChangeReason (Add, Remove, Update, Move, Refresh, or Clear) along with current and previous items and indexes. ChangeSet<T> exposes Count, Adds, Removes, Updates, Moves, and AsSpan().
ReactiveList<T> is a thread-safe observable list. It implements IList<T>, IList, IReadOnlyList<T>, INotifyCollectionChanged, INotifyPropertyChanged, and IDisposable.
| Member group | Key members |
|---|---|
| Constructors | new ReactiveList<T>(), new ReactiveList<T>(IEnumerable<T>), new ReactiveList<T>(T) |
| State and binding | Count, Items (ReadOnlyObservableCollection<T>), Version, IsDisposed |
| Streams | Stream, Added, Removed, Changed, CurrentItems |
| Single-item edits | Add, Insert, Remove, RemoveAt, Move, Update, this[int] |
| Bulk edits | AddRange (IEnumerable<T> or ReadOnlySpan<T>), InsertRange, RemoveRange, RemoveMany, ReplaceAll, Clear, ClearWithoutDeallocation, Edit |
| Snapshots | ToArray, CopyTo, AsMemory, AsSpan, GetEnumerator |
Reactive2DList<T> is a list of ReactiveList<T> rows for grids, tables, and matrices. It implements IReactiveList<ReactiveList<T>>.
It adds row and cell helpers to the list members: AddToInner, GetItem, SetItem, Insert, RemoveFromInner, ClearInner, Flatten, and TotalCount.
QuaternaryList<T> splits items across four internal shards, which are separate buckets with their own reader/writer locks. Sharding lowers lock contention and reduces allocation pressure on large batches.
You can attach a secondary index to a QuaternaryList<T>. A secondary index maps each item to a lookup key, such as category or venue, so you can read matching items or build filtered views without scanning every shard.
| Member group | Key members |
|---|---|
| Mutations | Add, AddRange, Remove, RemoveRange, RemoveMany, ReplaceAll, Edit, Clear |
| Reads | Count, Contains, CopyTo, Snapshot, ToArray, Stream, Version |
| Secondary indexes | AddIndex, GetItemsBySecondaryIndex, ItemMatchesSecondaryIndex, FilterBySecondaryIndex, CreateViewBySecondaryIndex, CreateDynamicViewBySecondaryIndex |
QuaternaryDictionary<TKey, TValue> is a four-shard observable dictionary for key-value caches, concurrent reads, bulk updates, and value-indexed queries.
| Member group | Key members |
|---|---|
| Mutations | Add, TryAdd, AddOrUpdate, AddRange, Remove, RemoveKeys, RemoveMany, Edit, Clear, this[TKey] |
| Reads | Count, ContainsKey, TryGetValue, Lookup, Keys, Values, CopyTo, Stream, Version |
| Secondary indexes | AddValueIndex, GetValuesBySecondaryIndex, ValueMatchesSecondaryIndex, FilterBySecondaryIndex, CreateViewBySecondaryIndex, CreateDynamicViewBySecondaryIndex |
QuadList<T> and QuadDictionary<TKey, TValue> are the single-shard storage types used inside the quaternary collections. Application code should normally use QuaternaryList<T> or QuaternaryDictionary<TKey, TValue>.
DeferNotifications() groups several writes into one notification. It is available on ReactiveList<T>, Reactive2DList<T>, QuaternaryList<T> and QuaternaryDictionary<TKey, TValue>.
using ReactiveList.Collections;
using var prices = new ReactiveList<decimal>();
using (prices.DeferNotifications())
{
prices.Add(10.5m);
prices.Add(11.0m);
prices.RemoveAt(0);
}
// Subscribers receive one Reset whose batch holds the final items.Reads see each write as soon as it commits. Scopes nest, and the collection publishes when the last scope closes. A scope with no changes publishes nothing.
IVersionedSnapshotSource<T> lets you copy a collection and then follow its changes without missing one or applying one twice. ReactiveList<T>, Reactive2DList<T>, QuaternaryList<T> and QuaternaryDictionary<TKey, TValue> implement it.
| Member | Meaning |
|---|---|
VersionedStream |
Each change as a VersionedNotification<T>, which pairs the CacheNotify<T> with the version that change produced. |
CopyVersioned(out long version) |
A copy of the items and the version that copy matches. |
Subscribe to VersionedStream first, then call CopyVersioned. Ignore any notification whose version is at most the version of the copy, because the copy already includes it.
using ReactiveList.Collections;
using ReactiveUI.Primitives;
using var source = new ReactiveList<int>([1, 2, 3]);
long copied = long.MaxValue;
using var subscription = source.VersionedStream.Subscribe(change =>
{
if (change.Version > Volatile.Read(ref copied))
{
// Apply change.Notification to your own copy.
}
});
var items = source.CopyVersioned(out var version);
Volatile.Write(ref copied, version);The sample drops changes that arrive before the copy is recorded. Queue them instead when writers run on other threads.
If the items in a source never change in place, create it with Options = new() { ItemsAreImmutable = true }. Views then ignore refresh notifications. Replacing an item still updates every view.
A view is a disposable, read-only projection over a collection. It listens to the source stream, marshals updates onto your chosen sequencer or scheduler, and exposes a bindable Items collection (ReadOnlyObservableCollection<T>) or Groups collection. Always dispose a view when its screen or workflow closes.
| View type | Purpose |
|---|---|
ReactiveView<T> |
Live filtered view built from a stream and initial snapshot. |
FilteredReactiveView<T> |
List view filtered by a fixed predicate. |
DynamicFilteredReactiveView<T> |
List view whose filter predicate comes from an IObservable<Func<T, bool>>. |
DynamicReactiveView<T> |
Search or query view driven by an observable query value. |
SortedReactiveView<T> |
List view kept in sorted order using an IComparer<T> or key selector. |
GroupedReactiveView<T, TKey> |
Grouped view exposing ReactiveGroup<TKey, T> collections by key. |
SecondaryIndexReactiveView<TKey, TValue> |
Dictionary view backed by a named secondary index. |
DynamicSecondaryIndexReactiveView<T, TKey> |
List secondary-index view driven by observable keys. |
DynamicSecondaryIndexDictionaryReactiveView<TKey, TValue> |
Dictionary secondary-index view driven by observable keys. |
Views throttle rapid updates for 50 milliseconds by default to protect UI threads during bursts. Pass throttleMs: 0 (or TimeSpan.Zero on view constructors) when you want immediate updates with no timer delay.
using ReactiveList;
using ReactiveList.Collections;
using ReactiveUI.Primitives.Concurrency;
using var list = new ReactiveList<int>([4, 1, 3, 2]);
using var sorted = list.SortBy(Comparer<int>.Default, Sequencer.Immediate, throttleMs: 0);
list.Edit(items =>
{
_ = items.Remove(2);
items.Add(5);
});
// sorted.Items is [1, 3, 4, 5] right away.Note
Passing throttleMs: 0 removes the view timer, not the source's own delivery model. Quaternary collections still publish notifications through their background channel.
Every view has a BatchResetLimit property. When one applied batch changes more items than the limit, the view updates its collection and then raises a single reset, not one notification per item. The default is int.MaxValue, so each changed item raises its own notification.
using var sorted = list.SortBy(Comparer<int>.Default, Sequencer.Default);
sorted.BatchResetLimit = 100;A lower limit helps UI lists that redraw faster from one reset than from hundreds of single changes.
A filtered view lists items in the order of its source. An item that starts to match after an update takes its source position.
using ReactiveList;
using ReactiveList.Collections;
using ReactiveUI.Primitives.Concurrency;
using ReactiveUI.Primitives.Signals;
using var products = new QuaternaryList<Product>();
products.AddIndex("ByCategory", static product => product.Category);
using var active = products.CreateView(static product => product.IsActive, Sequencer.Default);
using var grouped = products.GroupBy(static product => product.Category, Sequencer.Default);
using var hardware = products.CreateViewBySecondaryIndex("ByCategory", "Hardware", Sequencer.Default);
using var query = new BehaviorSignal<string>("saw");
using var search = products.CreateView(
query,
static (text, product) => product.Name.Contains(text, StringComparison.OrdinalIgnoreCase),
Sequencer.Default);
public sealed record Product(string Name, string Category, bool IsActive);Import ReactiveList.Queries, or ReactiveList.Reactive.Queries for the System.Reactive package. Start with a reactive collection's Live property and finish with a view or a stream:
using ReactiveList.Collections;
using ReactiveList.Queries;
using ReactiveUI.Primitives;
using ReactiveUI.Primitives.Concurrency;
using ReactiveUI.Primitives.Signals;
using var orders = new ReactiveList<Order>();
using var latestOpenOrders = orders.Live
.Where(static order => order.IsOpen)
.OrderByDescending(static order => order.Id)
.Take(20)
.ToView(Sequencer.Default);
var openCount = orders.Live.Count(static order => order.IsOpen);
using var countSubscription = openCount.Subscribe(Console.WriteLine);
orders.Add(new(1, IsOpen: true));
public sealed record Order(int Id, bool IsOpen);The view uses one subscription to the source for filtering, sorting and the window. Count, Any, Contains and dictionary ObserveValue report the current result when you subscribe and emit again only when it changes. SelectMany merges one observable per matching item and detaches it when that item leaves the query.
Query syntax works too, and each clause maps to one operator. A chain of where, orderby, Skip, Take and select still plans onto one view with one source subscription:
var page = from order in orders.Live
where order.IsOpen
orderby order.Id descending
select order.Id;
using var ids = page.ToView(Sequencer.Default);
var byStatus = from order in orders.Live
orderby order.Id
group order.Id by order.IsOpen;
using var groups = byStatus.ToView(Sequencer.Default);- Order:
OrderBy,ThenByand their descending forms are stable. Items that tie keep the order of the source. A sharded source has no stable order, so add a finalThenByon a unique key when you need an exact result. - Windows:
SkipandTakecompose as in LINQ, soTake(10).Skip(2)exposes the third to the tenth item. Either takes anIObservable<int>and the window follows it. The view is empty until each observable emits. Moving a window changes only the items that enter or leave it. - Groups: groups appear in the order their key first occurs in the query result, as
GroupBydoes in LINQ. Members keep the query order.GroupBy(key, element)holds a projected value in each group. A group view can be read from any thread while it changes. - Projections:
SelectafterOrderBy,SkiporTakeprojects what the window exposes and keeps the order and window.Where,Count,Any,ContainsandGroupByafter such a projection see the projected items.
LiveView and LiveGroupView expose BatchResetLimit, with the same default and meaning as the regular views. A window move larger than the limit also raises one reset.
Live queries honour source options and deferred notifications.
Operators on IObservable<CacheNotify<T>>:
| Method | What it does |
|---|---|
WhereAction, WhereAdded, WhereRemoved |
Keeps notifications matching an action. |
SelectItems, SelectAllItems |
Extracts single items or flattens single and batch items. |
OnItemAdded, OnItemRemoved, OnItemUpdated, OnItemMoved, OnCleared |
Streams specific item events. |
BufferNotifications, ThrottleNotifications |
Batches or throttles notification bursts over a TimeSpan. |
ObserveOnScheduler |
Moves notifications onto an ISequencer or IScheduler. |
TransformItems, FilterItems |
Maps or filters items inside notifications. |
AutoDisposeBatches |
Disposes PooledBatch<T> instances after downstream observers finish reading them. |
CountByAction |
Emits running counts per CacheAction. |
ToChange, ToChangeSets |
Converts cache notifications into Change<T> or ChangeSet<T> values. |
Operators on collections and IObservable<ChangeSet<T>>:
| Method | What it does |
|---|---|
Connect |
Connects an IReactiveSource<T> to a ChangeSet<T> stream starting with current items. |
CreateView, SortBy, GroupBy |
Builds filtered, dynamic, sorted, or grouped live views. |
FilterDynamic, WhereItems |
Filters notification streams with a static or observable predicate. |
WhereChanges, WhereReason, SelectChanges |
Filters or projects ChangeSet<T> entries. |
OnAdd, OnRemove, OnUpdate, OnMove |
Streams individual items by ChangeReason. |
GroupByChanges, GroupingByChanges |
Groups change streams by key. |
AutoRefresh |
Watches INotifyPropertyChanged items and emits refresh changes when properties update. |
Operators on QuaternaryList<T> and QuaternaryDictionary<TKey, TValue>:
FilterBySecondaryIndexfilters notification streams by one or more index keys.CreateViewBySecondaryIndexbuilds a live view for fixed index keys.CreateDynamicViewBySecondaryIndexbuilds a live view whose index keys come from an observable sequence.
| Category | Public types |
|---|---|
| Interfaces | IReactiveSource<T>, IReactiveSourceWithOptions, IVersionedSnapshotSource<T>, IReactiveList<T>, IQuaternaryList<T>, IQuaternaryDictionary<TKey, TValue>, IReactiveView<TView, TItem>, IEditableList<T>, IGroupedObservable<TKey, TElement>, ISecondaryIndex<T>, IResettable, IQuad<T> |
| Core notifications | CacheNotify<T>, CacheAction, Change<T>, ChangeReason, ChangeSet<T>, PooledBatch<T>, VersionedNotification<T> |
| Live queries | LiveQuery<T>, OrderedLiveQuery<T>, WindowedLiveQuery<T>, GroupedLiveQuery<TKey, T>, LiveView<T>, LiveGroupView<TKey, T>, LiveValue<TValue>, LiveQueryExtensions |
| Helpers and groups | ReactiveGroup<TKey, T>, SecondaryIndex<T, TKey>, ReactiveSourceOptions, NotificationDeferral, EditableListWrapperPool, PooledEditableListWrapper<T> |
Every class is sealed. Shared behaviour lives in static helpers, not in base classes.
Every public collection method is safe to call from multiple threads:
ReactiveList<T>andReactive2DList<T>guard mutations and snapshots with a dedicated lock.QuaternaryList<T>andQuaternaryDictionary<TKey, TValue>guard each of their four shards with an independentReaderWriterLockSlimand publish notifications through an unbounded channel.GetEnumerator(),ToArray(),Snapshot(), andAsMemory()return safe point-in-time copies.Disposeis safe to call more than once and from any thread, including from inside a notification handler.- A view applies changes on its sequencer or scheduler. Read a view's
Itemson that same thread, as you would anyObservableCollection<T>. AsSpan()onReactiveList<T>reads the backing storage without copying. CallAsSpan()only when your code guarantees no concurrent writes can happen while the span is in use.
Choose the API that matches your workload:
| Workload | Recommended approach |
|---|---|
| Several related list edits | Wrap changes in Edit(...) or call AddRange(...) instead of looping over Add(...). |
| Large concurrent lists | Use QuaternaryList<T>. |
| Concurrent key-value caches | Use QuaternaryDictionary<TKey, TValue>. |
| Repeated category or tag queries | Register a secondary index with AddIndex or AddValueIndex. |
| Several writes that should reach subscribers as one change | Wrap them in using (list.DeferNotifications()). |
| Filter, sort and page in one view | Use a live query, which plans the chain onto one source subscription. |
| High-rate UI updates | Bind to a view with a UI sequencer or scheduler and keep throttling enabled. Set BatchResetLimit for large batches. |
| Low-level stream consumers | Chain AutoDisposeBatches() so rented arrays return to the pool. |
Run builds and tests from the src folder so the .NET SDK picks up src/global.json and Microsoft.Testing.Platform:
cd src
dotnet restore ReactiveList.slnx
dotnet build ReactiveList.slnx -c Release --no-restore -warnaserror
dotnet test --project tests/ReactiveList.Tests/ReactiveList.Tests.csproj -c Release
dotnet test --project tests/ReactiveList.Reactive.Tests/ReactiveList.Reactive.Tests.csproj -c ReleaseBoth suites compile the same test files, once against each package. They include CsCheck model tests, which run random operation sequences against each collection, view and live query and compare the result with a simple reference model.
The WPF showcase (src/examples/ReactiveListTestApp) and its UI test suite (src/tests/ReactiveListTestApp.Tests) compile on Linux, macOS, and Windows, and run on Windows.
Chris Pulman London, UK |
Glenn Watson Melbourne, Australia |
ReactiveList is part of ReactiveUI and is released under the MIT license. We welcome contributions of every size, from bug reports and documentation to features and tests.
- Questions: ask in GitHub Discussions.
- Bugs and feature requests: open a GitHub issue.
- Larger changes: open an issue or discussion first, so we can agree on the approach before you start.
- Contributor guide: read reactiveui.net/contribute for building and testing and pull requests.
Every pull request must meet these standards. The build checks most of them.
- Follow the ReactiveUI C# style guide.
- The repository's
.editorconfigand the StyleSharp, PerformanceSharp, SecuritySharp, and PublicApiSharp analyzers run on every build. Fix each finding in the code. Do not suppress it or relax the.editorconfig. - Add tests for every bug fix and new feature.
- Document public APIs with XML documentation comments.
- Write commit messages in the Conventional Commits format.
- Follow the Code of Conduct.
- Sponsor the maintainers on GitHub Sponsors: reactivemarbles, glennawatson, and chrispulman.
- Ask your employer to support open source, for example with the balanced employee IP agreement.
JetBrains gives ReactiveUI's maintainers licences for its tools through its open source support programme. Anthropic supports them with Claude through Claude for Open Source. OpenAI supports them with Codex through Codex for Open Source. Snyk gives the maintainers access to security tools through its Secure Developer Program.
See our sponsors for more information. JetBrains, Claude, Anthropic, OpenAI and Codex names and logos are trademarks of their respective owners. Snyk and the Snyk logo are trademarks of Snyk Ltd.


