C# 3.5 Merge 2 lists of 2 different types
Posted
by
Ehsan
on Stack Overflow
See other posts from Stack Overflow
or by Ehsan
Published on 2010-12-23T17:42:53Z
Indexed on
2010/12/23
17:54 UTC
Read the original article
Hit count: 150
I have 2 generic Lists List<type1> L1
, List<type2> L2
in C# 3.5
Problem: type1 has an attribute called "key1" and type2 has an attribute called "key2" How to merge L1 and L2 on key1 = key2. Both lists are unsorted but I'm welcome to any ideas on how to sort the lists based on the attribute.
I'd like to be able to merge the two lists on a key. I know it's not a dictionary and it would've been nice if it was but there is a very specific reason why they are lists which I will not get in to because that is irrelevant.
© Stack Overflow or respective owner