2 // dynamic type attribute decoration
6 using System
.Collections
;
7 using System
.Runtime
.CompilerServices
;
8 using System
.Collections
.Generic
;
18 public const dynamic c
= default (dynamic);
20 public dynamic Prop { set; get; }
21 public dynamic Prop2 { set { }
}
23 public dynamic this[dynamic d
] { set { }
get { return 1; }
}
25 public dynamic Method (dynamic d
)
30 // Transformation handling required
33 public Func
<dynamic, int, dynamic[]> v
;
36 delegate dynamic Del (dynamic d
);
40 public static int Main ()
43 Type ca
= typeof (System
.Runtime
.CompilerServices
.DynamicAttribute
);
45 if (t
.GetMember ("a")[0].GetCustomAttributes (ca
, false).Length
!= 1)
48 if (t
.GetMember ("c")[0].GetCustomAttributes (ca
, false).Length
!= 1)
51 if (t
.GetMember ("Prop")[0].GetCustomAttributes (ca
, false).Length
!= 1)
54 if (t
.GetMember ("get_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
57 if (t
.GetMethod ("get_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
60 if (t
.GetMember ("set_Prop")[0].GetCustomAttributes (ca
, false).Length
!= 0)
63 if (t
.GetMethod ("set_Prop").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
66 if (t
.GetMethod ("set_Prop").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
69 if (t
.GetMember ("Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 1)
72 if (t
.GetMember ("set_Prop2")[0].GetCustomAttributes (ca
, false).Length
!= 0)
75 if (t
.GetMember ("Item")[0].GetCustomAttributes (ca
, false).Length
!= 1)
78 if (t
.GetMethod ("get_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
81 if (t
.GetMethod ("get_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
84 if (t
.GetMethod ("set_Item").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 0)
87 if (t
.GetMethod ("set_Item").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
90 if (t
.GetMethod ("set_Item").GetParameters ()[1].GetCustomAttributes (ca
, false).Length
!= 1)
93 if (t
.GetMember ("Method")[0].GetCustomAttributes (ca
, false).Length
!= 0)
96 if (t
.GetMethod ("Method").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
99 if (t
.GetConstructors ()[0].GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
102 if (t
.GetConstructors ()[0].GetCustomAttributes (ca
, false).Length
!= 0)
107 da
= t
.GetMember ("t")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
111 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
114 da
= t
.GetMember ("t2")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
118 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true }
))
121 da
= t
.GetMember ("v")[0].GetCustomAttributes (ca
, false)[0] as DynamicAttribute
;
124 if (!da
.TransformFlags
.SequenceEqual (new bool[] { false, true, false, false, true }
))
129 if (t
.GetMember ("Invoke")[0].GetCustomAttributes (ca
, false).Length
!= 0)
132 if (t
.GetMethod ("Invoke").GetParameters ()[0].GetCustomAttributes (ca
, false).Length
!= 1)
135 if (t
.GetMethod ("Invoke").ReturnParameter
.GetCustomAttributes (ca
, false).Length
!= 1)
138 Console
.WriteLine ("ok");