1: using System.Collections.Generic;
2: using System.Diagnostics;
3: using System.Linq;
4:
5: namespace ConsoleApplication1
6: {
7: public class KeyValue
8: {
9: public string Key { get; set; }
10: public string Value { get; set; }
11: }
12:
13: class Program
14: {
15: static void Main (string[] args)
16: {
17: var paramList = new List<KeyValue>
18: {
19: new KeyValue {Key = "Programming WCF", Value = "Currently Reading"},
20: new KeyValue {Key = "JavaScript: The Definitive Guide", Value = "Currently Reading"},
21: new KeyValue {Key = "Professional ASP.NET 3.5", Value = "Currently Reading"},
22: new KeyValue {Key = "JavaScript: The Good Parts", Value = "Next on the list"},
23: new KeyValue {Key = "AJAX and PHP", Value = "Eventually"},
24: new KeyValue {Key = "Agile Software Development", Value = "Someday"}
25: };
26:
27: var sortedList = from q in paramList orderby q.Key ascending select q;
28:
29: foreach (var k in sortedList)
30: {
31: Debug.WriteLine (string.Format("Key: \"{0}\" Value: \"{1}\"", k.Key, k.Value));
32: }
33: }
34: }
35: }