-2
可能重複:
Is there a more efficent way to randomise a set of LINQ results?C#從列表中隨機記錄與LINQ
我有300個記錄列表。我想與LINQ只返回不同的,隨機的記錄,只有50條記錄:
myCollection = list.Distinct().Take(50).ToList(); // myCollection is the new list
什麼是「Shuffle」 –
抱歉,放置錯誤的代碼,已經修復。 –
謝謝,效果很好 –