merge 99630:99762
[mono.git] / mcs / tests / test-492.cs
1 using System;\r
2 using System.Reflection;\r
3 \r
4 namespace Test {\r
5         [AttributeUsage (AttributeTargets.All, AllowMultiple = true)]\r
6         public class My1Attribute : Attribute\r
7         {\r
8                 public My1Attribute (object o)\r
9                 {\r
10                         if (o != null)\r
11                                 throw new ApplicationException ();\r
12                 }\r
13         }\r
14 \r
15         public class My2Attribute : Attribute\r
16         {\r
17                 public My2Attribute (string[] s)\r
18                 {\r
19                         if (s.Length != 0)\r
20                                 throw new ApplicationException ();\r
21                 }\r
22         }\r
23 \r
24         public class My3Attribute : Attribute\r
25         {\r
26                 public My3Attribute (byte b)\r
27                 {\r
28                         if (b != 0xFF)\r
29                                 throw new ApplicationException ();\r
30                 }\r
31         }\r
32 \r
33         \r
34         [My3(unchecked((byte)-1))]\r
35         [My1((object)null)]\r
36         [My1(null)]\r
37         [My2(new string[0])]\r
38         public class Test {\r
39                 static public int Main() {\r
40                         System.Reflection.MemberInfo info = typeof (Test);\r
41                         object[] attributes = info.GetCustomAttributes (false);\r
42                         \r
43                         if (attributes.Length != 4)\r
44                                 return 1;\r
45 \r
46                         for (int i = 0; i < attributes.Length; i ++) {\r
47                                 Console.WriteLine (attributes [i]);\r
48                         }\r
49                         \r
50                         return 0;\r
51                 }\r
52         }\r
53 }\r