c# - Filtering For duplicate entries in ICollectionView -


i have class

class abc() {     public string name{get;set;}     public string category{get;set;} } 

list formed class having value :-

 name = "a", category = "alphabet"  name = "1", category = "numeric"  name = "2", category = "numeric"  name = "b", category = "alphabet"  name = "a", category = "alphabet" 

i've applied filter(using icollectionview) on above list based on category "alphabets" , resulting list is:-

 name = "a", category = "alphabet"  name = "b", category = "alphabet"  name = "a", category = "alphabet" 

which working fine not able filter out duplicate entry list. using wpf mvvm. please help.

in filter callback return true if current object has needed category , first 1 name.

something this:

    ...     observablecollection<abc> items { get;set}     listcollectionview itemsview { get;set }     ...     // view filter logic     itemsview.filter = o =>             {                 var abc = o abc;                 if (abc == null) return false;                 return abc.category == "alphabet" &&                        abc == items.first(i => i.name == abc.name);             }; 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -