コンパイラ エラー CS0643

更新 : 2007 年 11 月

エラー メッセージ

'arg' 属性引数の名前が重複しています。

ユーザー定義の属性のパラメータ arg が 2 回指定されました。詳細については、「属性 (C# プログラミング ガイド)」を参照してください。

使用例

次の例では 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 ()
    {
    }
}