在C#中创建数组并添加数据有以下几种方法:
int[] numbers = {1, 2, 3, 4, 5};
int[] numbers = new int[5];
numbers[0] = 1;
numbers[1] = 2;
numbers[2] = 3;
numbers[3] = 4;
numbers[4] = 5;
int[] numbers = new int[5];
for (int i = 0; i < numbers.Length; i++)
{
numbers[i] = i + 1;
}
无论采用哪种方法,都可以为数组添加数据。