2 using System.Reflection;
3 using System.Reflection.Emit;
7 public void AvoidInlining()
17 public static int Main()
20 DynamicMethod method_builder = new DynamicMethod ("WriteHello" , typeof (int), new Type[] {typeof (Driver)}, typeof (Driver));
21 ILGenerator ilg = method_builder.GetILGenerator ();
23 ilg.Emit (OpCodes.Ldarg_0);
24 ilg.Emit (OpCodes.Call, typeof (Driver).GetMethod ("Foo"));
25 ilg.Emit (OpCodes.Ret);
27 int res = (int) method_builder.Invoke (null, new object[] {new Driver()});
28 return res == -99 ? 0 : 1;