12,549,161 members (48,715 online)
Rate this:
See more:
So, I have a two un-ordered list - result1 and result2 as listed below.
By using a code below I am able to populate result1 excluding the common items between those two lists.
This code works perfectly for the small size list. However, in real scenario I have two lists with millions of item on it. Using the similar way of eliminating the common values from one list into the other list is taking way too much time.
So, I was wondering if there is an more efficient way to deal with this kind of scenario.

```List<int[]> result1 = new List<int[]> { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 } };
List<int[]> result2 = new List<int[]> { new int[] { 2, 1, 3 }, new int[] { 7, 8, 9 } };

result2.ForEach(t => result1.RemoveAll(z => z.OrderBy(k=>k).SequenceEqual(t.OrderBy(k=>k))));```
Posted 8-Nov-12 12:20pm
Updated 8-Nov-12 12:44pm
Nelek105.4K
v2

Rate this:

## Solution 2

Top Experts
Last 24hrsThis month
 Dave Kreskowiak 100 ppolymorphe 100 Rbabs 75 Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ) 60 OriginalGriff 55
 OriginalGriff 3,902 Suvendu Shekhar Giri 1,713 John Simmons / outlaw programmer 1,687 ppolymorphe 1,541 Karthik Bangalore 1,210