Denxorz.ObservableCollectionWithAddRange 2.1.1

ObservableCollectionWithAddRange adds the AddRange and ClearAndAddRange methods to the ObservableCollection

Install-Package Denxorz.ObservableCollectionWithAddRange -Version 2.1.1
dotnet add package Denxorz.ObservableCollectionWithAddRange --version 2.1.1
<PackageReference Include="Denxorz.ObservableCollectionWithAddRange" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Denxorz.ObservableCollectionWithAddRange --version 2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Denxorz.ObservableCollectionWithAddRange, 2.1.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Denxorz.ObservableCollectionWithAddRange as a Cake Addin
#addin nuget:?package=Denxorz.ObservableCollectionWithAddRange&version=2.1.1

// Install Denxorz.ObservableCollectionWithAddRange as a Cake Tool
#tool nuget:?package=Denxorz.ObservableCollectionWithAddRange&version=2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ObservableCollectionWithAddRange

.Build status Coverage Status NuGet License

What does it do?

ObservableCollectionWithAddRange adds the AddRange and ClearAndAddRange methods to the ObservableCollection.

This can be used to speed up operations with WPF collection bindings that handle a lot of changes.

This package is based on the following articles:

Examples

What it looks like with the default System.Collections.ObjectModel.ObservableCollection:

var collection = new ObservableCollection<int> { 1, 2 };
collection.CollectionChanged += (s, e) => Console.WriteLine($"CollectionChanged: {e.Action}");

// Array with new items
var newItems = new[] { 3, 4, 5 };

// Replace all items by new items
collection.Clear();
foreach (var item in newItems)
{
    collection.Add(item);
}

// Output:
//   CollectionChanged: Reset
//   CollectionChanged: Add
//   CollectionChanged: Add
//   CollectionChanged: Add

What it looks like with ObservableCollectionWithAddRange:

// Denxorz.ObservableCollectionWithAddRange
var collection = new ObservableCollectionWithAddRange<int> { 1, 2 };
collection.CollectionChanged += (s, e) => Console.WriteLine($"CollectionChanged: {e.Action}");

// Array with new items
var newItems = new[] { 3, 4, 5 };

// Replace all items by new items
collection.ClearAndAddRange(newItems);

// Output:
//   CollectionChanged: Reset

Tools and Products Used

Versions & Release Notes

version 2.1.1: Added .NET 5.0

version 2.1: Added .NET Framework 4.5.2 again

version 2.0: Converted to .NET Standard 2.0

version 1.0: First version (.NET Framework 4.5.2)

ObservableCollectionWithAddRange

.Build status Coverage Status NuGet License

What does it do?

ObservableCollectionWithAddRange adds the AddRange and ClearAndAddRange methods to the ObservableCollection.

This can be used to speed up operations with WPF collection bindings that handle a lot of changes.

This package is based on the following articles:

Examples

What it looks like with the default System.Collections.ObjectModel.ObservableCollection:

var collection = new ObservableCollection<int> { 1, 2 };
collection.CollectionChanged += (s, e) => Console.WriteLine($"CollectionChanged: {e.Action}");

// Array with new items
var newItems = new[] { 3, 4, 5 };

// Replace all items by new items
collection.Clear();
foreach (var item in newItems)
{
    collection.Add(item);
}

// Output:
//   CollectionChanged: Reset
//   CollectionChanged: Add
//   CollectionChanged: Add
//   CollectionChanged: Add

What it looks like with ObservableCollectionWithAddRange:

// Denxorz.ObservableCollectionWithAddRange
var collection = new ObservableCollectionWithAddRange<int> { 1, 2 };
collection.CollectionChanged += (s, e) => Console.WriteLine($"CollectionChanged: {e.Action}");

// Array with new items
var newItems = new[] { 3, 4, 5 };

// Replace all items by new items
collection.ClearAndAddRange(newItems);

// Output:
//   CollectionChanged: Reset

Tools and Products Used

Versions & Release Notes

version 2.1.1: Added .NET 5.0

version 2.1: Added .NET Framework 4.5.2 again

version 2.0: Converted to .NET Standard 2.0

version 1.0: First version (.NET Framework 4.5.2)

  • .NETFramework 4.5.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net5.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 History

Version Downloads Last updated
2.1.1 84 2/6/2021
2.1.0 412 5/20/2019
2.0.0 544 6/23/2018
1.0.0 693 5/8/2017