WPF LINQ and the ObservableCollection?

What makes you think you can't use LINQ with ObservableCollection() { 1, 2, 3, 6, 8, 2, 4, 5, 3 }; var query = collection. Where(x => x % 2 == 0); foreach (int x in query) { Console. WriteLine(x); } } }.

It implements Collection so it should be fine. For example: using System; using System.Collections. ObjectModel; using System.

Linq; class Test { static void Main() { var collection = new ObservableCollection() { 1, 2, 3, 6, 8, 2, 4, 5, 3 }; var query = collection. Where(x => x % 2 == 0); foreach (int x in query) { Console. WriteLine(x); } } }.

Thank you. Sorry. I remember there were problems with some queries, but now I have tried and everything works.

– pileggi Jul 15 '10 at 16:21.

Just for anybody else who may come across this issue with trying to filter an ObservableCollection but find that they can't. Jon is absolutely correct in that there is no reason why you can't do this but the key thing for a newbie or for someone who has been developing with WPF for a while, is that you need to include the "using System. As you soon as you do this, you can do a ".

Where" query on your object.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions