471,347 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 software developers and data experts.

Re: Linq queries on a List<KeyValuePair<>>

Well, I'd have to wonder why you don't just use Dictionary<,/
SortedList<,/ SortedDictionary<,(and just use .Keys and .Values)

But something like below:

List<KeyValuePair<DateTime, double>list = null;
List<DateTimekeys = list.Select(x =x.Key).ToList();
List<doublevalues = list.Select(x =x.Value).ToList();
List<doublevaluesByKey = list.OrderBy(x =x.Key)
.Select(x =x.Value).ToList();

You could also use the alternative LINQ syntax, but the above should work.

Jul 1 '08 #1
0 2012

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.