Populating a list of integers in .NET

If you're using .Net 3.5, Enumerable.Range is what you need.

Generates a sequence of integral numbers within a specified range.


LINQ to the rescue:

// Adding value to existing list
var list = new List<int>();
list.AddRange(Enumerable.Range(1, x));

// Creating new list
var list = Enumerable.Range(1, x).ToList();

See Generation Operators on LINQ 101