In my WPF application I'd like to use LINQ as much as possible (especially to avoid foreach). But WPF works a lot with the ObservableCollection, and I can't use LINQ with these kind of collection. What can I do?
In my WPF application I'd like to use LINQ as much as possible (especially to avoid foreach). But WPF works a lot with the ObservableCollection, and I can't use LINQ with these kind of collection. What can I do?
The OP asked especially for the LINQ ".ForEach()" Method, which cannot be used on ObservableCollection< T >, since it's implemented for List< T > only.
There is another SO-Topic, where I found my solution: https://stackoverflow.com/a/200584/2408978
You need my ObservableComputations library maybe. That is .NET API designed especially to work with LINQ like queries to ObservableCollection in WPF and other .NET UI frameworks that support binding to INotifyCollectionChanged and INotifyPropertyChanged objects (Xamarin, Blazor).