首页 > 代码库 > List 随机排序

List 随机排序

List<T> l = new List<T>();l = l.Select(a => new { a, newID = Guid.NewGuid() }).OrderBy(b => b.newID).Select(c=>c.a).ToList();
 List<string> iList = new List<string>();            iList = iList.Select(a => new { a, newID = Guid.NewGuid() }).OrderBy(b => b.newID).Select(c => c.a).ToList();//随机排序