I am trying to figure out how to handle combining or combining two lists that may have duplicates. For example, List1 has {A, B, C} and List2 has {B, C, D}. I tried using the Union operation and got a new list with values (A, B, C, D). However, I need the values of B and C from the second list, not the first. Is there a way to specify a union method that duplicates the value to use.
The code I'm using now is
var newList = List1.Union<Object>(List2).ToList();
Thanks for any help. Javid
source
share