public void aa() { var obj = new TestClass1(); var cecilTestClass1 = CurrentAssembly.FindRuntimeType(typeof(TestClass1)); cecilTestClass1.Methods.First(method => method.Name == "TestMethod"); var method1 = cecilTestClass1.GetMethodByName("TestMethod"); var dynMethod = Recompiler.RecompileMethod(method1); var result = dynMethod.Invoke(obj, new object[] { obj }); Assert.AreEqual("ab", (string)result); Assert.AreEqual(obj.a, 1); }
public void Init() { CurrentAssembly = Cecil.AssemblyDefinition.ReadAssembly(Reflection.Assembly.GetExecutingAssembly().Location); ThisType = CurrentAssembly.FindRuntimeType(GetType()); Recompiler = new ILDynaRec.Recompiler(); }
public void Init() { CurrentAssembly = Cecil.AssemblyDefinition.ReadAssembly(Reflection.Assembly.GetExecutingAssembly().Location); ThisType = CurrentAssembly.FindRuntimeType(GetType()); Recompiler = new ILDynaRec.Recompiler(); }
public void Init() { CurrentAssembly = CecilExtensions.CurrentAssembly; ThisType = CurrentAssembly.FindRuntimeType(GetType()); Recompiler = new ILDynaRec.Recompiler(); }