Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
namespace Nota.Presentation;
/// <summary>An ObservableCollection whose whole contents can be swapped with one Reset
/// notification — a search over a big sample library would otherwise raise one Add per row.</summary>
public sealed class BulkObservableCollection<T> : ObservableCollection<T>
{
public void ReplaceAll(IEnumerable<T> items)
{
CheckReentrancy();
Items.Clear();
foreach (var item in items) Items.Add(item);
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Count)));
OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}