-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ObservableCollection #32
Comments
I've got some preliminary code going in a branch. For AddRange, what would you expect to happen to the CollectionChanged events that would normally fire for each item added?
|
Thanks for getting back to this. This is my custom AddRange implementation for the ObservableCollection which I've been using for a long time now. There are a few cases where you would want it to fire per item but for me this is too slow.
|
Unless things have changed since 2009, it seems like the main motivation for having AddRange is to avoid firing an event for each item added. However, at least at the time of writing, "ListCollectionView doesn’t implement support for non-single item CollectionChanged events." https://blogs.msdn.microsoft.com/nathannesbit/2009/04/20/addrange-and-observablecollection/ The @Symbai any way you could test it out, see if the extra workaround is needed or not? I should mention that branch requires you to have the latest .NET Core 3 preview SDK to build it. |
I've been using my custom AddRange for a lot of WPF controls now without having any issues at all. A month ago it was officially added in .NET Core 3 repo, but later it got revert dotnet/corefx#38115 Anyway, in my case the extra workaround is not required. Tested it and it works fine and is faster than the ObservableCollection for many items, nice work! |
Fyi I'm closing this, hope that's okay |
@Symbai That's great that it's working for you! However, I'm going to re-open this for now, as I haven't ported over any of the unit tests or benchmarks for Collection/ObservableCollection, and thus I'm not ready to merge the branch in question yet and include it in the NuGet package. I'll close the issue when I merge the observable-collection branch, after I've got unit tests and benchmarks running, and I'm satisfied with the benchmark results. Thanks for checking it out. |
Would be amazing if you could add support for ObservableCollection as it's the only collection type that fully supports binding. If you add support I would recommend or suggest you also add a AddRange method as the original collection hasn't but for performance reasons it's a must-have. There are many modified versions that added such as a method but none which is optimized with ArrayPool etc.
The text was updated successfully, but these errors were encountered: