Tuesday, 3 November 2015

Generate random numbers from List in c# using Linq


  • This article is to demonstrate how to generate the random number from the generic List<T> using Linq.
  • First of all we'll create the list of results which is in ascending order.
  • Then we'll select each record from the results, ordered by Guid each time.This gives randomness.
  • Thereafter we'll return the list.



  • Finally access the list however you want.

No comments:

Post a Comment

How To Pass An Array As A Parameter While Calling an ASP.NET Web API C#

Please visit my C# Corner Blog for this, where I have provided better efforts to make this concept more understandable - www.c-sharpcorner....