CS0643 de erro do compilador

Mensagem de erro

argumento de atributo nomeado duplicado 'arg'

Um parâmetro, arg, em um atributo definido pelo usuário foi especificado duas vezes. Para obter mais informações, consulte Atributos (guia de programação C#).

Exemplo

O exemplo a seguir gera 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 ()
    {
    }
}