Pylon.ObservableList
1.0.0-beta-00001
dotnet add package Pylon.ObservableList --version 1.0.0-beta-00001
NuGet\Install-Package Pylon.ObservableList -Version 1.0.0-beta-00001
<PackageReference Include="Pylon.ObservableList" Version="1.0.0-beta-00001" />
<PackageVersion Include="Pylon.ObservableList" Version="1.0.0-beta-00001" />
<PackageReference Include="Pylon.ObservableList" />
paket add Pylon.ObservableList --version 1.0.0-beta-00001
#r "nuget: Pylon.ObservableList, 1.0.0-beta-00001"
#:package Pylon.ObservableList@1.0.0-beta-00001
#addin nuget:?package=Pylon.ObservableList&version=1.0.0-beta-00001&prerelease
#tool nuget:?package=Pylon.ObservableList&version=1.0.0-beta-00001&prerelease
Pylon.ObservableList
ObservableList<T>
is a simple, extensible list that emits INotifyCollectionChanged
events for each mutable
operation. If you find ObservableCollection<T>
or AvaloniaList<T>
incomplete for your use case, consider
using and extending ObservableList<T>
with your own custom operations.
Getting Started
Install the Pylon.ObservableList
package.
dotnet add package Pylon.ObservableList
Compatibility
ObservableList<T>
is intended to be used with Avalonia and is compatible with the mutable operations of
AvaloniaList<T>
. However, it should be usable with any INotifyCollectionChanged
consumers. Listed below is the
comparison between the mutable operations of each list.
ObservableList<T> |
AvaloniaList<T> |
---|---|
Add(T) |
Add(T) |
AddRange(IEnumerable<T>) |
AddRange(IEnumerable<T>) |
Clear() |
Clear() |
Insert(int, T) |
Insert(int, T) |
InsertRange(int, IEnumerable<T>) |
InsertRange(int, IEnumerable<T>) |
Move(int int) |
Move(int int) |
MoveRange(int, int, int) |
MoveRange(int, int, int) |
Remove(T) |
Remove(T) |
RemoveAll(IEnumerable<T>) |
RemoveAll(IEnumerable<T>) |
RemoveAt(int) |
RemoveAt(int) |
RemoveRange(int, int) |
RemoveRange(int, int) |
this[int] |
this[int] |
Reverse() |
|
Reverse(int, int) |
|
RotateLeft(int) |
|
RotateLeft(int, int, int) |
|
RotateRight(int) |
|
RotateRight(int, int, int) |
Extending ObservableList<T>
ObservableList<T>
exposes both the underlying Items
list and methods for publishing INotifyCollectionChanged
events. The example below demonstrates how to extend ObservableList<T>
with custom operations.
public static class ObservableListExtensions
{
public static void AddRange<T>(this ObservableList<T> list, IEnumerable<T> collection)
{
var index = list.Items.Count;
list.Items.AddRange(collection);
if (list.Items.Count > index)
{
if (list.CanNotify)
{
var @event = new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Add,
list.Items[index..],
index);
list.NotifyCollectionChanged(@event);
}
list.NotifyCountChanged();
}
}
}
More examples can be found in ObservableListExtensions.
Building
Build using dotnet
.
dotnet build --configuration release
Test using dotnet
.
dotnet test
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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 was computed. 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. |
-
net8.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 |
---|---|---|
1.0.0-beta-00001 | 71 | 10/2/2024 |