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();//随机排序

 

你可能感兴趣的:(list)