Compilerwarnung (Stufe 1) CS3016

Aktualisiert: November 2007

Fehlermeldung

Arrays als Attributargumente sind nicht CLS-kompatibel.
Arrays as attribute arguments is not CLS-compliant

Die Übergabe eines Arrays an ein Attribut ist nicht mit der Common Language Specification (CLS) kompatibel. Weitere Informationen über die CLS-Kompatibilität finden Sie unter Schreiben von CLS-kompatiblem Code und CLS (Common Language Specification).

Beispiel

CS3016 wird im folgenden Beispiel generiert:

// 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 ()
    {
    }
}