LiteObservableCollections 5.5.1
dotnet add package LiteObservableCollections --version 5.5.1
NuGet\Install-Package LiteObservableCollections -Version 5.5.1
<PackageReference Include="LiteObservableCollections" Version="5.5.1" />
<PackageVersion Include="LiteObservableCollections" Version="5.5.1" />
<PackageReference Include="LiteObservableCollections" />
paket add LiteObservableCollections --version 5.5.1
#r "nuget: LiteObservableCollections, 5.5.1"
#:package LiteObservableCollections@5.5.1
#addin nuget:?package=LiteObservableCollections&version=5.5.1
#tool nuget:?package=LiteObservableCollections&version=5.5.1
LiteObservableCollections
Lite version of ObservableCollections with fewer features but better performance.
Features
- Lightweight observable list and collection implementations.
- Implements
INotifyCollectionChangedandINotifyPropertyChanged. - Supports batch addition via
AddRange. - ObservableViewList: reactive view over
ObservableList<T>with filter, sort, and optional projection; filter/sort are persisted across source updates.
Usage
ObservableList<T>
using LiteObservableCollections;
var list = new ObservableList<int>();
list.CollectionChanged += (s, e) => Console.WriteLine($"Action: {e.Action}");
list.Add(1);
list.Add(2);
list.AddRange(new[] { 3, 4, 5 }); // AddRange triggers a Reset event
Console.WriteLine(string.Join(", ", list)); // Output: 1, 2, 3, 4, 5
ObservableCollection<T>
using LiteObservableCollections;
var collection = new ObservableCollection<string>();
collection.CollectionChanged += (s, e) => Console.WriteLine($"Action: {e.Action}");
collection.Add("A");
collection.Add("B");
collection.AddRange(new[] { "C", "D" }); // AddRange triggers a single Add event with all new items
Console.WriteLine(string.Join(", ", collection)); // Output: A, B, C, D
Move Support
Both types support moving items:
list.Move(0, 2); // Moves the first item to index 2
collection.Move(1, 0); // Moves the second item to the first position
ObservableViewList<T>
A reactive view over an ObservableList<T> that supports filtering and sorting. Changes in the source list are reflected in the view. Filter and sort are persisted: Refresh() (e.g. when the source changes) re-applies them.
View without projection (same element type):
var source = new ObservableList<string> { "Banana", "Apple", "Cherry" };
using var view = new ObservableViewList<string>(source);
// Filter: only items containing "a"
view.AttachFilter(s => s.Contains('a'));
// view: Banana, Apple
// Reset filter
view.ResetFilter();
// Sort by default comparer (or AttachSort(comparison))
view.AttachSort();
// view: Apple, Banana, Cherry
// Restore source order
view.ResetSort();
View with projection (ObservableViewList<TSource, TResult>):
var source = new ObservableList<int> { 1, 2, 3 };
using var view = new ObservableViewList<int, string>(source, x => $"Item {x}");
// view: "Item 1", "Item 2", "Item 3"
view.AttachFilter(x => x >= 2);
// view: "Item 2", "Item 3"
AttachFilter(predicate)/ResetFilter()— filter operates on source elements (before projection).AttachSort()/AttachSort(comparer)/AttachSort(comparison)/ResetSort()— sort operates on view elements. Sort is re-applied on eachRefresh().ObservableViewListimplementsIDisposable; dispose to unsubscribe from the source.
EventListeners
ObservableList<T> raises collection-level notifications only. To react to a property change on an item, the item must implement INotifyPropertyChanged. You can inherit from ObservableObject to implement the standard notification pattern:
using LiteObservableCollections.ComponentModel;
public sealed class Person : ObservableObject
{
private string _name = string.Empty;
public string Name
{
get => _name;
set => SetProperty(ref _name, value);
}
}
Use PropertyChangedEventListener to register handlers for all properties or a specific property. The listener is IDisposable; dispose it when the subscription is no longer needed.
using LiteObservableCollections.EventListeners;
var person = new Person();
using var listener = new PropertyChangedEventListener(person);
listener.RegisterHandler((_, e) =>
Console.WriteLine($"{e.PropertyName} changed"));
listener.RegisterHandler(nameof(Person.Name), (_, _) =>
Console.WriteLine("Name changed"));
person.Name = "Ada";
You can also use a property expression to avoid string literals:
listener.RegisterHandler(() => person.Name, (_, _) =>
Console.WriteLine("Name changed"));
To observe property changes from every item in an ObservableList<T> or ObservableCollection<T>, use CollectionItemPropertyChangedListener<T>. It automatically tracks adds, removes, replacements, resets, and duplicate references in the source collection.
using LiteObservableCollections;
using LiteObservableCollections.EventListeners;
var people = new ObservableList<Person>();
using var itemListener = new CollectionItemPropertyChangedListener<Person>(people);
itemListener.ItemPropertyChanged += (_, e) =>
Console.WriteLine($"{e.Item.Name}.{e.PropertyChangedEventArgs.PropertyName} changed");
var person = new Person();
people.Add(person);
person.Name = "Ada";
CollectionChangedEventListener provides the same pattern for collection events and can filter handlers by NotifyCollectionChangedAction:
using System.Collections.Specialized;
using LiteObservableCollections;
using LiteObservableCollections.EventListeners;
var list = new ObservableList<Person>();
using var listener = new CollectionChangedEventListener(list);
listener.RegisterHandler(NotifyCollectionChangedAction.Add, (_, e) =>
Console.WriteLine($"Added {e.NewItems?.Count} item(s)"));
list.Add(new Person());
For subscriptions whose lifetime is shorter than the event source, use PropertyChangedWeakEventListener or CollectionChangedWeakEventListener from LiteObservableCollections.EventListeners.WeakEvents. They retain the listener weakly, helping prevent the source from keeping the listener alive. Keep a strong reference to the listener for as long as it should receive events, and still call Dispose() when deterministic unsubscription is needed.
using LiteObservableCollections.EventListeners.WeakEvents;
var listener = new PropertyChangedWeakEventListener(person);
listener.RegisterHandler(nameof(Person.Name), (_, _) =>
Console.WriteLine("Name changed"));
ObservableViewListrefreshes itself when its source collection changes. An item'sPropertyChangedevent does not automatically reapply the view's filter or sort; handle the item event and callview.Refresh()when needed.
Why AddRange?
The AddRange method allows you to efficiently add multiple items at once, reducing the number of notifications and improving performance in UI scenarios.
ObservableList<T>.AddRangetriggers aResetevent for maximum compatibility.ObservableCollection<T>.AddRangetriggers a singleAddevent with all new items, which is more efficient for most UI frameworks.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.5.1 | 45 | 7/23/2026 |
| 5.5.0 | 42 | 7/23/2026 |
| 5.4.0 | 104 | 6/27/2026 |
| 5.3.0 | 111 | 6/4/2026 |
| 5.2.0 | 138 | 3/27/2026 |
| 5.1.0 | 130 | 3/3/2026 |
| 5.0.1 | 130 | 2/28/2026 |
| 5.0.0 | 118 | 2/28/2026 |
| 4.1.0 | 130 | 2/13/2026 |
| 4.0.0 | 131 | 2/3/2026 |
| 3.2.0 | 222 | 12/24/2025 |
| 3.1.0 | 198 | 11/28/2025 |
| 3.0.1 | 235 | 11/27/2025 |
| 3.0.0 | 256 | 10/20/2025 |
| 2.0.0 | 289 | 8/28/2025 |
| 1.2.0 | 288 | 8/28/2025 |
| 1.1.0 | 296 | 8/26/2025 |
| 1.0.1 | 291 | 8/26/2025 |
| 1.0.0 | 278 | 8/26/2025 |