MintPlayer.ObservableCollection
1.0.1
See the version list below for details.
dotnet add package MintPlayer.ObservableCollection --version 1.0.1
NuGet\Install-Package MintPlayer.ObservableCollection -Version 1.0.1
<PackageReference Include="MintPlayer.ObservableCollection" Version="1.0.1" />
paket add MintPlayer.ObservableCollection --version 1.0.1
#r "nuget: MintPlayer.ObservableCollection, 1.0.1"
// Install MintPlayer.ObservableCollection as a Cake Addin #addin nuget:?package=MintPlayer.ObservableCollection&version=1.0.1 // Install MintPlayer.ObservableCollection as a Cake Tool #tool nuget:?package=MintPlayer.ObservableCollection&version=1.0.1
MintPlayer.ObservableCollection
Extended version of System.Collections.ObjectModel.ObservableCollection. This class allows you to:
- Use AddRange, invoking the CollectionChanged event only once
- Monitor properties of the items in the collection
NuGet package
https://www.nuget.org/packages/MintPlayer.ObservableCollection/
Installation
NuGet package manager
Open the NuGet package manager and install the MintPlayer.ObservableCollection package in the project
Package manager console
Install-Package MintPlayer.ObservableCollection
Usage
Example 1
var collection = new ObservableCollection<string>();
collection.CollectionChanged += (sender, e) =>
{
Console.WriteLine($"Collection changed:");
if (!e.NewItems.IsNullOrEmpty())
{
var newItemsArray = new string[e.NewItems.Count];
e.NewItems.CopyTo(newItemsArray, 0);
Console.WriteLine($"- items added: {string.Join(", ", newItemsArray)}");
}
if (!e.OldItems.IsNullOrEmpty())
{
var oldItemsArray = new string[e.OldItems.Count];
e.OldItems.CopyTo(oldItemsArray, 0);
Console.WriteLine($"- items removed: {string.Join(", ", oldItemsArray)}");
}
};
collection.Add("Michael");
//collection.Enabled = false;
collection.Add("Junior");
//collection.Enabled = true;
collection.Add("Jackson");
Example 2
public class Person : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
private string firstname;
public string FirstName
{
get { return firstname; }
set
{
firstname = value;
OnPropertyChanged();
}
}
private string lastname;
public string LastName
{
get { return lastname; }
set
{
lastname = value;
OnPropertyChanged();
}
}
public string FullName => $"{firstname} {lastname}";
}
Program.cs
var collection = new ObservableCollection<Person>();
collection.CollectionChanged += (sender, e) =>
{
Console.WriteLine($"Collection changed:");
if (!e.NewItems.IsNullOrEmpty())
{
var newItemsArray = new Person[e.NewItems.Count];
e.NewItems.CopyTo(newItemsArray, 0);
Console.WriteLine($"- items added: {string.Join(", ", newItemsArray.Select(p => p.FullName))}");
}
if (!e.OldItems.IsNullOrEmpty())
{
var oldItemsArray = new Person[e.OldItems.Count];
e.OldItems.CopyTo(oldItemsArray, 0);
Console.WriteLine($"- items removed: {string.Join(", ", oldItemsArray.Select(p => p.FullName))}");
}
};
collection.ItemPropertyChanged += (sender, e) =>
{
Console.WriteLine($"Item property changed: {e.PropertyName}");
};
var person1 = new Person { FirstName = "John", LastName = "Doe" };
var person2 = new Person { FirstName = "Jimmy", LastName = "Fallon" };
var person3 = new Person { FirstName = "Michael", LastName = "Douglas" };
// Add 3 items at once
collection.AddRange(new[] {
person1,
person2,
person3
});
// Change an item property
collection[1].LastName = "Knibble";
// Remove 2 items at once
collection.RemoveRange(new[] { person1, person3 });
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.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 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. 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. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on MintPlayer.ObservableCollection:
Package | Downloads |
---|---|
KarnaughMap
This package contains a .NET Core Windows Forms control that renders a Karnaugh-map which is fully interactive. |
|
MintPlayer.ObservableCollection.Extensions
Extension methods for MintPlayer.ObservableCollection |
|
MintPlayer.KarnaughMap
This package contains a .NET Core Windows Forms control that renders a Karnaugh-map which is fully interactive. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.3.4 | 119 | 1/3/2025 |
9.3.3 | 108 | 1/3/2025 |
9.3.2 | 99 | 12/30/2024 |
9.3.1 | 72 | 12/30/2024 |
9.3.0 | 87 | 12/30/2024 |
9.2.0 | 92 | 12/29/2024 |
9.1.0 | 86 | 12/29/2024 |
9.0.0 | 117 | 11/13/2024 |
8.2.1 | 117 | 8/5/2024 |
8.2.0 | 135 | 2/28/2024 |
8.1.0 | 200 | 12/20/2023 |
8.0.0 | 266 | 11/14/2023 |
7.0.1 | 848 | 11/18/2022 |
7.0.0 | 351 | 11/17/2022 |
7.0.0-preview.1 | 110 | 10/31/2022 |
6.0.4 | 386 | 11/18/2022 |
6.0.3 | 420 | 10/31/2022 |
6.0.1 | 600 | 9/19/2022 |
6.0.0 | 540 | 9/19/2022 |
1.5.0 | 629 | 7/22/2021 |
1.4.0 | 373 | 6/28/2021 |
1.3.0 | 418 | 6/25/2021 |
1.2.2 | 664 | 11/7/2020 |
1.2.1 | 481 | 9/17/2020 |
1.2.0 | 640 | 7/7/2020 |
1.2.0-preview3 | 307 | 7/7/2020 |
1.2.0-preview2 | 298 | 7/7/2020 |
1.2.0-preview1 | 302 | 7/7/2020 |
1.1.1 | 462 | 7/7/2020 |
1.1.0 | 451 | 7/7/2020 |
1.0.7 | 419 | 7/7/2020 |
1.0.6 | 525 | 6/28/2020 |
1.0.5 | 542 | 6/27/2020 |
1.0.4 | 566 | 6/27/2020 |
1.0.3 | 457 | 6/8/2020 |
1.0.2 | 467 | 6/5/2020 |
1.0.1 | 452 | 6/5/2020 |
1.0.0 | 760 | 10/18/2019 |