Possible Duplicate:
Populating a list of integers in .NET
除此之外,还有没有更简单或更优雅的方法来初始化C#中的整数列表?
List<int> numberList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
或
f或(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 m或e practical solution?
谢谢,
科科斯群岛