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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -