컴파일러 오류 CS0579

업데이트: 2007년 11월

오류 메시지

'attribute' 특성이 중복되었습니다.
Duplicate 'attribute' attribute

같은 특성을 두 번 이상 지정하려면 해당 특성의 AttributeUsage에서 AllowMultiple=true와 같이 지정하십시오.

예제

다음 예제에서는 CS0579 오류가 발생하는 경우를 보여 줍니다.

// CS0579.cs
using System;
public class MyAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.All,AllowMultiple=true)]
public class MyAttribute2 : Attribute
{
}

public class z
{
    [MyAttribute, MyAttribute]     // CS0579
    public void zz()
    {
    }

    [MyAttribute2, MyAttribute2]   // OK
    public void zzz()
    {
    }

    public static void Main()
    {
    }
}