CollectionChanged and IList of Items - why the difficulties
.net, c#, collections, inotifycollectionchanged, observablecollection
Solution
Inspired by VirtualBlackFox's answer I took a look under the hood of the `CollectionView` classes in ILSpy. It appears that the primary reason why the lack of support for Range operations is because internally the `CollectionView` uses a change log to centrally manage pending changes of all kinds and dispatch messages on a per/item basis.
By its very purpose, the `CollectionView` could store 1000s of records used simultaneously with multiple UI controls representing its underlying data. So, adding or deleting records must be done on an atomic basis to maintain the integrity of the UI controls that access the view information. You can't synchronize incremental changes with multiple UI subscribers using bulk change events without passing the grouping, sorting, and filtering functionality of the CollectionView onto the UI controls that use it.
The `CollectionView` also derives from `System.Windows.Threading.Dispatcher` so the issue may be co-related to how it manages work items on it's thread. The call path includes a protected `ProcessCollectionChanged` method that specifically processes individual changes on the UI thread. So, updating ranges may interfere with the whole threading model it uses to interact with UI elements that use it.
I totally agree that having consumers of the `CollectionView` pass in an `IList` to `NotifyCollectionChangedEventArgs` is silly. It specifically rejects anything with a length != 1 and hard-codes for `args.NewItems[0]` internally.
Problem
I am looking into the topic why a `ObservableCollection/ListCollectionView/CollectionView` raises a NotSuportedException when calling the CollectionChanged with the parameter of IList. ``` //Throws an exception private void collectionChanged_Removed(IList items) { if (CollectionChanged != null) CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, items)); } ``` I have found several Webpages, talking about this topic and they suggest either using the `Reset` ability to force a complete redraw of the UI, or just simply call for each item the `CollectionChanged` or some more creative way: http://geekswithblogs.net/NewThingsILearned/archive/2008/01/16/listcollectionviewcollectionview-doesnt-support-notifycollectionchanged-with-multiple-items.aspx I just cant find the WHY? For me it makes no sense why this would be the case. Is there any chance that this lacking feature, which we all face at some point in our Development Cycle, since the Add method just has to much of an overhead when you want to Add multiple items fast, will be implemented any time (.Net 5, C# 6...). Edit: In my specific case, I have written my own class : ``` public class ObservableList<T> : IList<T>, IList, IEnumerable<T>, INotifyCollectionChanged { public event NotifyCollectionChangedEventHandler CollectionChanged; //other stuff... } ``` And still throws the said NotSupportedException.