string[] words = { "the", "quick", "brown", "fox", "jumps" };
IEnumerable<string> query = from word in words orderby word.Length select word;
foreach (string str in query) Console.WriteLine(str);
主要降序排序
string[] words = { "the", "quick", "brown", "fox", "jumps" };
IEnumerable<string> query = from word in words orderby word.Substring(0, 1) descendingselect word;
foreach (string str in query) Console.WriteLine(str);
次要升序排序
string[] words = { "the", "quick", "brown", "fox", "jumps" };
IEnumerable<string> query = from word in words orderby word.Length, word.Substring(0, 1) select word;
foreach (string str in query) Console.WriteLine(str);
次要降序排序
string[] words = { "the", "quick", "brown", "fox", "jumps" };
IEnumerable<string> query = from word in words orderby word.Length, word.Substring(0, 1) descendingselect word;
foreach (string str in query) Console.WriteLine(str);