I\'m having a List
, which is return from the remote data source (i.e., WCF). So, I need to modify the following data into a user-frien
>
This is a simple and flexible solution, it will handle multiple inner lists with any number of dimensions.
List> PersonInfo = new List>()
{
new List() {"John", "Peter", "Watson"},
new List() {"1000", "1001", "1002"}
};
var result = PersonInfo
.SelectMany(inner => inner.Select((item, index) => new { item, index }))
.GroupBy(i => i.index, i => i.item)
.Select(g => g.ToList())
.ToList();