Compiler Error CS0270

不能在变量声明中指定数组大小(请尝试使用“new”表达式初始化)

将大小指定为数组声明的一部分时会发生此错误。若要解决此错误,请使用 new 运算符表达式。

下面的示例生成 CS0270:

// CS0270.cs
// compile with: /t:module

public class Test
{
   int[10] a;   // CS0270
   // To resolve, use the following line instead:
   // int[] a = new int[10];
}