共用方式為


編譯器錯誤 CS0270

更新:2007 年 11 月

錯誤訊息

變數宣告中不能指定陣列大小 (請嘗試用 'new' 運算式初始化)

若在陣列宣告中指定大小,便會發生這個錯誤。解決方法是使用 new 運算子運算式。

下列範例會產生 CS0270:

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

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