2 // dynamic type attribute decoration
6 using System
.Collections
;
7 using System
.Runtime
.CompilerServices
;
8 using System
.Collections
.Generic
;
22 public const dynamic c
= default (dynamic);
24 public dynamic Prop { set; get; }
25 public dynamic Prop2 { set { }
}
27 public dynamic this[dynamic d
] { set { }
get { return 1; }
}
29 public dynamic Method (dynamic d
)
34 // Transformation handling required
37 public Func
<dynamic, int, dynamic[]> v
;
38 public I
<dynamic>[] iface
;
41 delegate dynamic Del (dynamic d
);
45 public static int Main ()
48 Type ca
= typeof (System
.Runtime
.CompilerServices
.DynamicAttribute
);
50 if (t
.GetMember ("a")[0].GetCustomAttributes (ca
, false).Length
!= 1)
53 if (t
.GetMember ("c")[0].GetCustomAttributes (ca
, false).Length
!= 1)
56 if (t
.GetMember ("Prop")[0].GetCustomAttributes (ca
, false).Length
!= 1)
59 if (t
.GetMember ("get_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
62 if (t
.GetMethod ("get_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
65 if (t
.GetMember ("set_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
68 if (t
.GetMethod ("set_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
71 if (t
.GetMethod ("set_Prop").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
74 if (t
.GetMember ("Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 1)
77 if (t
.GetMember ("set_Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 0)
80 if (t
.GetMember ("Item")[0].GetCustomAttributes (ca
, false).Length
!= 1)
83 if (t
.GetMethod ("get_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
86 if (t
.GetMethod ("get_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
89 if (t
.GetMethod ("set_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
92 if (t
.GetMethod ("set_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
95 if (t
.GetMethod ("set_Item").GetParameters ()[1].GetCustomAttributes (ca
, false).Length
!= 1)
98 if (t
.GetMember ("Method")[0].GetCustomAttributes (ca
, false).Length
!= 0)
101 if (t
.GetMethod ("Method").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
104 if (t
.GetConstructors ()[0].GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
107 if (t
.GetConstructors ()[0].GetCustomAttributes (ca
, false).Length
!= 0)
112 da
= t
.GetMember ("t")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
116 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
119 da
= t
.GetMember ("t2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
123 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
126 da
= t
.GetMember ("v")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
129 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true, false, false, true }
))
132 da
= t
.GetMember ("iface")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
135 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, false, true }
))
140 if (t
.GetMember ("Invoke")[0].GetCustomAttributes (ca
, false).Length
!= 0)
143 if (t
.GetMethod ("Invoke").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
146 if (t
.GetMethod ("Invoke").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
149 Console
.WriteLine ("ok");