Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS3016 

Error Message

Arrays as attribute arguments is not CLS-compliant

It is not compliant with the Common Language Specification (CLS) to pass an array to an attribute. For more information on CLS Compliance, see Writing CLS-Compliant Code and Common Language Specification.

Example

The following example generates 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 ()
    {
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft