更新:2007 年 11 月
错误消息
作为属性参数的数组不符合 CLS
将数组传递给属性不符合公共语言规范 (CLS)。有关 CLS 遵从性的更多信息,请参见编写符合 CLS 的代码和公共语言规范。
示例
下面的示例生成 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 ()
{
}
}