2 using System.Reflection;
\r
5 [AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
\r
6 public class My1Attribute : Attribute
\r
8 public My1Attribute (object o)
\r
11 throw new ApplicationException ();
\r
15 public class My2Attribute : Attribute
\r
17 public My2Attribute (string[] s)
\r
20 throw new ApplicationException ();
\r
24 public class My3Attribute : Attribute
\r
26 public My3Attribute (byte b)
\r
29 throw new ApplicationException ();
\r
34 [My3(unchecked((byte)-1))]
\r
37 [My2(new string[0])]
\r
39 static public int Main() {
\r
40 System.Reflection.MemberInfo info = typeof (Test);
\r
41 object[] attributes = info.GetCustomAttributes (false);
\r
43 if (attributes.Length != 4)
\r
46 for (int i = 0; i < attributes.Length; i ++) {
\r
47 Console.WriteLine (attributes [i]);
\r