3 using System.Reflection;
6 public class MyAttribute: Attribute {
8 public MyAttribute (string stuff) {
9 System.Console.WriteLine (stuff);
13 public class My2Attribute: MyAttribute {
15 public My2Attribute (string stuff, int blah) : base (stuff) {
16 System.Console.WriteLine ("ctor with int val"+stuff);
21 [My2("testclass", 22)]
23 static public int Main() {
24 System.Reflection.MemberInfo info = typeof (Test);
25 object[] attributes = info.GetCustomAttributes (false);
26 for (int i = 0; i < attributes.Length; i ++) {
27 System.Console.WriteLine(attributes[i]);
29 if (attributes.Length != 2)
31 MyAttribute attr = (MyAttribute) attributes [0];
32 if (attr.val != "testclass")