Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, I have data Like that in List 1: Value1, Value2, Value3

And in List 2 data like that: Value1.1, Value2.1, Value3.1

And I want at the final Output it to look like that in the List:

Column[0]: Value1, Value1.1
Column[1]: Value2, Value2.1
Column[2]: Value2, Value2.1

So that the second List added beside the first List and not under the first List.

What I have tried:

I tryd at first like this:

var result = list1.Zip(list2, (xp, y) => (xp, y));


but that not working because the result list is not an normal string list like I need.

Anyone an Idea how to change it to get an normal

List<string> result
Posted
Updated 24-Jan-23 4:20am
Comments
Member 15627495 24-Jan-23 9:29am    
why don't you use a Array<list> or List<list>?

1 solution

The page at Enumerable.Zip Method (System.Linq) | Microsoft Learn[^] actually contains an example of the code that you need.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900