2 using System
.Reflection
;
6 public class MyAttribute
: Attribute
{
8 public MyAttribute (string stuff
) {
9 System
.Console
.WriteLine (stuff
);
14 public class My2Attribute
: MyAttribute
{
16 public My2Attribute (string stuff
, int blah
) : base (stuff
) {
17 System
.Console
.WriteLine ("ctor with int val"+stuff
);
28 [My2("testclass", 22)]
30 public static int Main() {
31 System
.Reflection
.MemberInfo info
= typeof (Test
);
32 object[] attributes
= info
.GetCustomAttributes (false);
33 for (int i
= 0; i
< attributes
.Length
; i
++) {
34 System
.Console
.WriteLine(attributes
[i
]);
36 if (attributes
.Length
!= 2)
38 MyAttribute attr
= (MyAttribute
) attributes
[0];
39 if (attr
.val
!= "testclass")