I need a list of integers from 1 to x where x is set by the user. I could build it with a for loop eg assuming x is an integer set previously:
List
LINQ to the rescue:
// Adding value to existing list var list = new List(); list.AddRange(Enumerable.Range(1, x)); // Creating new list var list = Enumerable.Range(1, x).ToList();
See Generation Operators on LINQ 101