2 [AttributeUsage (AttributeTargets
.Class
| AttributeTargets
.Interface
, AllowMultiple
= true)]
3 public class SimpleAttribute
: Attribute
{
7 public string MyNamedArg
;
11 public SimpleAttribute (string name
)
16 public string AnotherArg
{
25 public long LongValue
{
32 public long[] ArrayValue
{
42 [Simple ("Interface test")]
43 public interface IFoo
{
44 void MethodOne (int x
, int y
);
45 bool MethodTwo (float x
, float y
);
48 [Simple ("Fifth", D
=new double[] { -1 }
)]
53 [Simple ("Fifth", D
=new double[0])]
58 [Simple ("Dummy", MyNamedArg
= "Dude!")]
59 [Simple ("Vids", MyNamedArg
= "Raj", AnotherArg
= "Foo")]
60 [Simple ("Trip", LongValue
=0)]
61 [Simple ("Fourth", ArrayValue
=new long[] { 0 }
)]
64 public static int Main ()
66 object o
= (((SimpleAttribute
)typeof(Blah2
).GetCustomAttributes (typeof (SimpleAttribute
), false)[0]).D
);
67 if (o
.ToString () != "System.Double[]")
70 if (((double[])o
)[0].GetType () != typeof (double))
73 o
= (((SimpleAttribute
)typeof(Blah3
).GetCustomAttributes (typeof (SimpleAttribute
), false)[0]).D
);
74 if (o
.ToString () != "System.Double[]")
77 Console
.WriteLine ("OK");