📜  c#代码示例中的数组声明

📅  最后修改于: 2022-03-11 14:49:01.508000             🧑  作者: Mango

代码示例5
// Syntax: data_type[] variable_name = new data_type[size];

// Decalring array of integers of length 5
int[] intArr = new int[5];

// Declaring array of strings of length 5
string[] names = new string[5];

// We can also populate the array, if we know the elements in advance
int[] evenDigits = new int[] {0,2,4,6,8}; // notice that in this, we don't need explicit size declaration.