[sdks] Fix README.md
[mono-project.git] / mcs / tests / test-500.cs
blobdd2ca605bc6315beb6ca5b38fd6f820a65b52ef9
1 using System;
2 using System.Reflection;
4 [AttributeUsage(AttributeTargets.Field, AllowMultiple=false)]
5 class SomeCustomAttribute : Attribute {
6 public SomeCustomAttribute ()
11 class MainClass {
13 [SomeCustomAttribute]
14 public int a;
16 [SomeCustomAttribute]
17 public int x, y;
19 public static int Main ()
21 Type t = typeof (MainClass);
22 FieldInfo[] fia = t.GetFields();
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;
31 Console.WriteLine ("OK");
33 return 0;