标签:play 排序 hsi order lin border esc div write
using System; using System.Collections; using System.Linq; namespace ConsoleApp1 { class Program { static void Main(string[] args) { string[] array = { "a.m.", "a", "Smith", "Jones", "module", "zoology", "youth", "Hsieh", "abdomen", "Xerox", "season", "Luncheon", "transferable","macro","genuine" }; //var array = from a in names orderby a ascending select a;//升序 //var array = from a in names orderby a descending select a;//降序 var array = from a in array orderby Guid.NewGuid() select a; //打乱顺序序,每次运行结果都不一样 foreach (var item in array ) { Console.WriteLine(item); } Console.ReadKey(); } } }
ascending 默认不指名就是ascending 升序
descending 降序
//Linq var array = from a in names orderby a descending select a;//降序
每次运行结果都不一样,
//Linq var array = from a in array orderby Guid.NewGuid() select a; //打乱顺序序,每次运行结果都不一样
Linq 对string[]字符串数组进行排序 (升序、降序、乱序)
标签:play 排序 hsi order lin border esc div write
原文地址:https://www.cnblogs.com/xe2011/p/12172934.html