C# Linq: Restructuring object

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2012-03-27T17:26:53Z Indexed on 2012/03/27 17:29 UTC
Read the original article Hit count: 216

Filed under:

I'd like to take an object like this:

SortedList<string, SortedList<int, SortedList<DateTime, double>>> Data

and, for a given 'int' value (key of first nested sorted list), restructure it like this:

SortedList<DateTime, SortedList<string, double>>

or, better yet, this:

SortedList<DateTime, double[]>

where each 'double[]' has as many elements as there are KeyValue pairs in the SortedList.

I'm guessing Linq is the way to go, but can't figure it out. Thanks for any suggestions.

© Stack Overflow or respective owner

Related posts about c#