更新:2007 年 11 月
错误消息
“arg”重复命名属性参数参数 arg 在用户定义的属性上被指定了两次。有关更多信息,请参见
示例
下面的示例生成 CS0643:
// CS0643.cs
using System;
using System.Runtime.InteropServices;
[AttributeUsage(AttributeTargets.Class)]
public class MyAttribute : Attribute
{
public MyAttribute()
{
}
public int x;
}
[MyAttribute(x = 5, x = 6)] // CS0643, error setting x twice
// try the following line instead
// [MyAttribute(x = 5)]
class MyClass
{
}
public class MainClass
{
public static void Main ()
{
}
} | |