共用方式為


編譯器警告 (層級 1) CS3016

更新:2007 年 11 月

錯誤訊息

以陣列做為屬性引數不符合 CLS 標準

傳遞陣列給屬性 (Attribute) 不符合 Common Language Specification (CLS) 標準。如需 CLS 標準符合性的詳細資訊,請參閱撰寫符合 CLS 標準的程式碼Common Language Specification

範例

下列範例會產生 CS3016:

// CS3016.cs

using System;

[assembly : CLSCompliant(true)]
[C(new int[] {1, 2})]   // CS3016
// try the following line instead
// [C()]
class C : Attribute
{
    public C()
    {
    }

    public C(int[] a)
    {
    }

    public static void Main ()
    {
    }
}