Random array using LINQ and C#

后端 未结 6 1478
北恋
北恋 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:50

    Best I can do off the top of my head without access to Visual Studio (crosses fingers):

    System.Random rnd = New System.Random();
    IEnumerable numbers = Enumerable.Range(1, 100).OrderBy(rnd => rnd.Next);
    

提交回复
热议问题