Saturday, September 15, 2012

Enumerable.Range

To loop through a sequence of numbers we can use Enumerable.Range static method.

var x= (from i in Enumerable.Range(0,12)

select i).ToArray();

Above code will create array of integers with values from 0 to 11.

 

Note:

  • First argument is start index
  • Second argument is Count

No comments:

Post a Comment