Compilerfehler CS0579
Doppeltes "Attribut"-Attribut.
Ein Attribut kann nur dann mehrmals angegeben werden, wenn für das betreffende Attribut in AttributeUsage AllowMultiple=true angegeben ist.
Beispiel
Im folgenden Beispiel wird der Fehler CS0579 generiert
// 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()
{
}
}