2 using System
.Reflection
;
6 public class MyAttribute
: Attribute
{
8 public MyAttribute (string stuff
) {
9 System
.Console
.WriteLine (stuff
);
14 public interface ITest
{
16 [My ("testifaceproperty")] get;
22 public static int Main () {
23 System
.Reflection
.MemberInfo info
= typeof (Test
);
24 object[] attributes
= info
.GetCustomAttributes (false);
25 for (int i
= 0; i
< attributes
.Length
; i
++) {
26 System
.Console
.WriteLine(attributes
[i
]);
28 if (attributes
.Length
!= 1)
30 MyAttribute attr
= (MyAttribute
) attributes
[0];
31 if (attr
.val
!= "testclass")
34 info
= typeof (ITest
).GetMethod ("get_TestProperty");
35 attributes
= info
.GetCustomAttributes (false);
36 for (int i
= 0; i
< attributes
.Length
; i
++) {
37 System
.Console
.WriteLine(attributes
[i
]);
39 if (attributes
.Length
!= 1)
42 attr
= (MyAttribute
) attributes
[0];
43 if (attr
.val
!= "testifaceproperty")