Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-500.cs
1 using System;
2 using System.Reflection;
3
4 [AttributeUsage(AttributeTargets.Field, AllowMultiple=false)]
5 class SomeCustomAttribute : Attribute {
6         public SomeCustomAttribute ()
7         {
8         }
9 }
10
11 class MainClass {
12
13         [SomeCustomAttribute]
14         public int a;
15
16         [SomeCustomAttribute]
17         public int x, y;
18
19         public static int Main ()
20         {
21                 Type t = typeof (MainClass);
22                 FieldInfo[] fia = t.GetFields();
23
24                 foreach (FieldInfo fi in fia) {
25                         object[] ca = fi.GetCustomAttributes(typeof (SomeCustomAttribute), false);
26                         System.Console.WriteLine ("Field: {0} [{1}]", fi.Name, ca.Length);
27                         if (ca.Length != 1)
28                                 return 1;
29                 }
30                 
31                 Console.WriteLine ("OK");
32                 
33                 return 0;
34         }
35 }