Random array using LINQ and C#

后端 未结 6 1480
北恋
北恋 2020-12-02 00:10

I was reading an article on MSDN Magazine about using the Enumerable class in LINQ to generate a random array. The article uses VB.NET and I\'m not immediately sure what the

6条回答
  •  甜味超标
    2020-12-02 00:28

    Using the C5 Generic Collection Library, you could just use the builtin Shuffle() method:

    IList numbers = new ArrayList(Enumerable.Range(1,100));
    numbers.Shuffle();
    

提交回复
热议问题