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();//隨機排序
相關文章
相關標籤/搜索