MintPlayer.ObservableCollection.Extensions
10.0.2
dotnet add package MintPlayer.ObservableCollection.Extensions --version 10.0.2
NuGet\Install-Package MintPlayer.ObservableCollection.Extensions -Version 10.0.2
<PackageReference Include="MintPlayer.ObservableCollection.Extensions" Version="10.0.2" />
<PackageVersion Include="MintPlayer.ObservableCollection.Extensions" Version="10.0.2" />
<PackageReference Include="MintPlayer.ObservableCollection.Extensions" />
paket add MintPlayer.ObservableCollection.Extensions --version 10.0.2
#r "nuget: MintPlayer.ObservableCollection.Extensions, 10.0.2"
#:package MintPlayer.ObservableCollection.Extensions@10.0.2
#addin nuget:?package=MintPlayer.ObservableCollection.Extensions&version=10.0.2
#tool nuget:?package=MintPlayer.ObservableCollection.Extensions&version=10.0.2
MintPlayer.ObservableCollection.Extensions
Extension methods for the built-in System.Collections.ObjectModel.ObservableCollection<T>.
These work on the standard ObservableCollection<T>, so you can use them without adopting
MintPlayer.ObservableCollection.
Installation
dotnet add package MintPlayer.ObservableCollection.Extensions
Bulk operations
using MintPlayer.ObservableCollection.Extensions;
collection.AddRange(items);
collection.RemoveRange(items);
collection.RemoveRange(start: 2, count: 3);
Bounded collections
Keep at most N items — useful for a "recent items" list that must not grow without limit. Excess
items are dropped from the head by default, or from the tail with ECollectionSide:
recentSearches.Add(term, maxItemCount: 10);
recentSearches.Insert(0, term, maxItemCount: 10, removeItemsAt: ECollectionSide.Tail);
Distinct adds
Add only if not already present; the bool says whether the item was added, and the range
overloads return the items that were actually added:
var added = tags.AddDistinct(tag);
var newTags = tags.AddDistinctRange(incoming);
// With your own notion of equality, and a cap:
tags.AddDistinct(tag, maxItemCount: 20, comparer: StringComparer.OrdinalIgnoreCase);
Every distinct/bounded overload composes: maxItemCount, an IEqualityComparer<T>, and the side
to trim from can be combined.
Related packages
- MintPlayer.ObservableCollection — a replacement
ObservableCollection<T>that raisesCollectionChangedonce for a range, monitors item properties, and can be updated from any thread
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- MintPlayer.ObservableCollection (>= 10.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on MintPlayer.ObservableCollection.Extensions:
| Repository | Stars |
|---|---|
|
sn4k3/NetSonar
Network pings and other utilities
|