C# - how to get distinct items from a Collection View
问题 CollectionView view = CollectionView)CollectionViewSource.GetDefaultView(MyData); View.Filter = i => ((MyClass)i).MyProperty; I have a collection view like in the above. The problem is that the collection MyData which has already been bound to a listview contains duplicate items. How do I get unique items as the result of my filtering? 回答1: This method works: CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(c.Items); view.Filter = i => { var index1 = c.MyData