How to

create range of numbers

Published: 25. November 2011 | Updated: 25. November 2011
License: Microsoft Public License (MS-PL)
Categories: Collections, Framework » Math
Tags: C# Collections Math
Was this snippet helpful for you? YESYES / NONO

Snippet example shows simple way how to create range of integers
int start = 8;
int count = 10;
IEnumerable<int> range = Enumerable.Range(start, count);

foreach (int i in range)
{
    Console.WriteLine(i);
}
Console Output:
8
9
10
11
12
13
14
15
16
17
Send us feedback about this snippet »



Related Snippets: