Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Compiler Error CS3016

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.

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

See Also

What Is the Common Language Specification

Show:
© 2015 Microsoft