2 using System.Reflection;
6 //[AttributeUsage (AttributeTargets.All)]
7 public class MyAttribute: Attribute {
9 public MyAttribute (string stuff) {
10 System.Console.WriteLine (stuff);
17 static public int Main() {
18 System.Reflection.MemberInfo info = typeof (Test);
19 object[] attributes = info.GetCustomAttributes (false);
20 for (int i = 0; i < attributes.Length; i ++) {
21 System.Console.WriteLine(attributes[i]);
23 if (attributes.Length != 1)
25 MyAttribute attr = (MyAttribute) attributes [0];
26 if (attr.val != "testclass")