Update Haiku support (#15674)
[mono-project.git] / mono / tests / bug-322722_patch_bx.2.cs
blob510affa064f4740e6e83a49009a4b0ebe22638e7
1 using System;
2 using System.Reflection;
3 using System.Reflection.Emit;
6 class Driver {
7 public void AvoidInlining()
11 public int Foo()
13 AvoidInlining();
14 return -99;
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;