KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Populating a list of integers in .NET Is there a simpler or more elegant way of initializing a list of integers in C# other than this? List<int> numberList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; or for(int i = 1; i <= 10; i++) { numberList.Add(i); } It just doesn't seem very practical - especially if the list was to contain a large number of values. Would a loop be a more practical solution? Thanks, CC
Tags (comma-separated)
Save Edits
Cancel