-using System;\r
-using System.Reflection;\r
-\r
-[AttributeUsage(AttributeTargets.Field, AllowMultiple=false)]\r
-class SomeCustomAttribute : Attribute {\r
- public SomeCustomAttribute ()\r
- {\r
- }\r
-}\r
-\r
-class MainClass {\r
-\r
- [SomeCustomAttribute]\r
- public int a;\r
-\r
- [SomeCustomAttribute]\r
- public int x, y;\r
-\r
- public static int Main ()\r
- {\r
- Type t = typeof (MainClass);\r
- FieldInfo[] fia = t.GetFields();\r
-\r
- foreach (FieldInfo fi in fia) {\r
- object[] ca = fi.GetCustomAttributes(typeof (SomeCustomAttribute), false);\r
- System.Console.WriteLine ("Field: {0} [{1}]", fi.Name, ca.Length);\r
- if (ca.Length != 1)\r
- return 1;\r
- }\r
- \r
- Console.WriteLine ("OK");\r
- \r
- return 0;\r
- }\r
+using System;
+using System.Reflection;
+
+[AttributeUsage(AttributeTargets.Field, AllowMultiple=false)]
+class SomeCustomAttribute : Attribute {
+ public SomeCustomAttribute ()
+ {
+ }
+}
+
+class MainClass {
+
+ [SomeCustomAttribute]
+ public int a;
+
+ [SomeCustomAttribute]
+ public int x, y;
+
+ public static int Main ()
+ {
+ Type t = typeof (MainClass);
+ FieldInfo[] fia = t.GetFields();
+
+ foreach (FieldInfo fi in fia) {
+ object[] ca = fi.GetCustomAttributes(typeof (SomeCustomAttribute), false);
+ System.Console.WriteLine ("Field: {0} [{1}]", fi.Name, ca.Length);
+ if (ca.Length != 1)
+ return 1;
+ }
+
+ Console.WriteLine ("OK");
+
+ return 0;
+ }
}
\ No newline at end of file