using System;
public class TrueFalseAttribute : Attribute
{
bool bWritten;
public bool Written()
{
return bWritten;
}
public TrueFalseAttribute(bool Written)
{
bWritten = Written;
}
}
public class StringAttribute : Attribute
{
string sStage;
public string Stage()
{
return sStage;
}
public StringAttribute(string Stage)
{
sStage = Stage;
}
}
[TrueFalseAttribute(true)]
[StringAttribute("Coding")]
public class Class1
{
}
class MainClass
{
public static void Main()
{
Console.WriteLine("Class1 attributes: ");object[] aAttributes = Attribute.GetCustomAttributes(typeof(Class1));
foreach (object attr in aAttributes)
{
Console.WriteLine(attr);
}
}
}
Class1 attributes:
StringAttribute
TrueFalseAttribute