2 // dynamic type attribute decoration
6 using System
.Collections
;
7 using System
.Runtime
.CompilerServices
;
8 using System
.Collections
.Generic
;
26 public const dynamic c
= default (dynamic);
28 public dynamic Prop { set; get; }
29 public dynamic Prop2 { set { }
}
31 public dynamic this[dynamic d
] { set { }
get { return 1; }
}
33 public dynamic Method (dynamic d
)
38 // Transformation handling required
41 public Func
<dynamic, int, dynamic[]> v
;
42 public I
<dynamic>[] iface
;
43 public Action
<int[], object, dynamic> d2
;
46 delegate dynamic Del (dynamic d
);
50 public static int Main ()
53 Type ca
= typeof (System
.Runtime
.CompilerServices
.DynamicAttribute
);
55 if (t
.GetMember ("a")[0].GetCustomAttributes (ca
, false).Length
!= 1)
58 if (t
.GetMember ("c")[0].GetCustomAttributes (ca
, false).Length
!= 1)
61 if (t
.GetMember ("Prop")[0].GetCustomAttributes (ca
, false).Length
!= 1)
64 if (t
.GetMember ("get_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
67 if (t
.GetMethod ("get_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
70 if (t
.GetMember ("set_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
73 if (t
.GetMethod ("set_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
76 if (t
.GetMethod ("set_Prop").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
79 if (t
.GetMember ("Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 1)
82 if (t
.GetMember ("set_Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 0)
85 if (t
.GetMember ("Item")[0].GetCustomAttributes (ca
, false).Length
!= 1)
88 if (t
.GetMethod ("get_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
91 if (t
.GetMethod ("get_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
94 if (t
.GetMethod ("set_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
97 if (t
.GetMethod ("set_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
100 if (t
.GetMethod ("set_Item").GetParameters ()[1].GetCustomAttributes (ca
, false).Length
!= 1)
103 if (t
.GetMember ("Method")[0].GetCustomAttributes (ca
, false).Length
!= 0)
106 if (t
.GetMethod ("Method").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
109 if (t
.GetConstructors ()[0].GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
112 if (t
.GetConstructors ()[0].GetCustomAttributes (ca
, false).Length
!= 0)
115 if (t
.GetCustomAttributes (ca
, false).Length
!= 1)
120 da
= t
.GetMember ("t")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
124 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
127 da
= t
.GetMember ("t2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
131 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
134 da
= t
.GetMember ("v")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
137 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true, false, false, true }
))
140 da
= t
.GetMember ("iface")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
143 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, false, true }
))
146 da
= t
.GetMember ("d2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
149 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, false, false, false, true }
))
154 if (t
.GetMember ("Invoke")[0].GetCustomAttributes (ca
, false).Length
!= 0)
157 if (t
.GetMethod ("Invoke").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
160 if (t
.GetMethod ("Invoke").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
163 Console
.WriteLine ("ok");