共用方式為


編譯器錯誤 CS0622

更新:2007 年 11 月

錯誤訊息

只可以使用陣列初始設定運算式來指派給陣列型別。請試著使用 new 運算式代替。

適用於初始化陣列的語法被用在非陣列的宣告中。

範例

下列範例會產生 CS0622:

// CS0622.cs
using System;

public class Test
{
    public static void Main ()
    {
        Test t = { new Test() };   // CS0622
        // Try the following instead:
        // Test[] t = { new Test() };
    }
}