I have 2 string Lists. In the first List I have 30 or more entries. For the second list, I need to merge 3 items and add them to list 2 as 1 item.
Here an example of what I mean:
List<string> dinosaurs = new List<string>();
dinosaurs.Add("Tyrannosaurus");
dinosaurs.Add("Amargasaurus");
dinosaurs.Add("Mamenchisaurus");
dinosaurs.Add("Deinonychus");
dinosaurs.Add("Compsognathus");
dinosaurs.Add("VelociRaptor")
List<string> dinosaursmerged = new List<string>();
Inside this list there are two items, which contain:
item1 = "Tyrannosaurus; Amargasaurus; Mamenchisaurus"
item2 = "Mamenchisaurus; Mamenchisaurus; VelociRaptor"
I tried it with the stringbuilder
and with concat
but had no success.
Any help or advice would be great - thanks for your time.