c# - Remove Duplicates from Class only if both strings are duplicates -


i have c# class contains 2 strings, ordernumber , trackingnumber. created list of class , put data it. need remove duplicate ordernumber , trackingnumber both duplicates. class might contain duplicate ordernumber trackingnumbers different need keep both.

thanks, andrew

you concatenate these strings , select based on concatenated string.

list<item> list = new list<item>(); item[] result = list.groupby(x => new {x.trackingnumber, x.ordernumber}).select(x => x.first()).toarray(); 

this should work if aren't dealing billions of entries.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -