I have 3 collection list as below.
public static List<Thing> English = new List<Thing>
{
new Thing {ID = 1, Stuff = "one"},
new Thing {ID = 2, Stuff = "two"},
new Thing {ID = 3, Stuff = "three"}
};
public static List<Thing> Spanish = new List<Thing>
{
new Thing {ID = 1, Stuff = "uno"},
new Thing {ID = 2, Stuff = "dos"},
new Thing {ID = 3, Stuff = "tres"},
new Thing {ID = 4, Stuff = "cuatro"}
};
public static List<Thing> German = new List<Thing>
{
new Thing {ID = 1, Stuff = "eins"},
new Thing {ID = 2, Stuff = "zwei"},
new Thing {ID = 3, Stuff = "drei"}
};
During runtime, the length of the list may vary. For eg, German may take 5 values, english with 2 and spanish with one.
I need to find which list has the max value and need to get the output in the below format.
Id English German Spanish
1 one eins uno
2 two zwei dos
3 three drei tres
4 cuatro
Can you please help me to solve this.
Try this:
The idea is to tag the original items with their collection origin (
1for English,2for German,3for Spanish), group them by ID, and then pull the details for individual languages using the tag that we added in the first step.