By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,671 Members | 1,387 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,671 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.