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
;
39 public Action
<int[], object, dynamic> d2
;
42 delegate dynamic Del (dynamic d
);
46 public static int Main ()
49 Type ca
= typeof (System
.Runtime
.CompilerServices
.DynamicAttribute
);
51 if (t
.GetMember ("a")[0].GetCustomAttributes (ca
, false).Length
!= 1)
54 if (t
.GetMember ("c")[0].GetCustomAttributes (ca
, false).Length
!= 1)
57 if (t
.GetMember ("Prop")[0].GetCustomAttributes (ca
, false).Length
!= 1)
60 if (t
.GetMember ("get_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
63 if (t
.GetMethod ("get_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
66 if (t
.GetMember ("set_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
69 if (t
.GetMethod ("set_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
72 if (t
.GetMethod ("set_Prop").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
75 if (t
.GetMember ("Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 1)
78 if (t
.GetMember ("set_Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 0)
81 if (t
.GetMember ("Item")[0].GetCustomAttributes (ca
, false).Length
!= 1)
84 if (t
.GetMethod ("get_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
87 if (t
.GetMethod ("get_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
90 if (t
.GetMethod ("set_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
93 if (t
.GetMethod ("set_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
96 if (t
.GetMethod ("set_Item").GetParameters ()[1].GetCustomAttributes (ca
, false).Length
!= 1)
99 if (t
.GetMember ("Method")[0].GetCustomAttributes (ca
, false).Length
!= 0)
102 if (t
.GetMethod ("Method").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
105 if (t
.GetConstructors ()[0].GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
108 if (t
.GetConstructors ()[0].GetCustomAttributes (ca
, false).Length
!= 0)
113 da
= t
.GetMember ("t")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
117 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
120 da
= t
.GetMember ("t2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
124 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
127 da
= t
.GetMember ("v")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
130 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true, false, false, true }
))
133 da
= t
.GetMember ("iface")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
136 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, false, true }
))
139 da
= t
.GetMember ("d2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
142 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, false, false, false, true }
))
147 if (t
.GetMember ("Invoke")[0].GetCustomAttributes (ca
, false).Length
!= 0)
150 if (t
.GetMethod ("Invoke").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
153 if (t
.GetMethod ("Invoke").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
156 Console
.WriteLine ("ok");