mercredi 28 octobre 2015

Create an Instance of a Type, via Emit(Opcodes.Call, methodinfo)

I'm using Reflection, and ilGenerator, to create a .Exe, that calls a method from a dll. My problem is when it is an instance method, i have to put in stack the instance before calling the method. Therefore i have a method in c#, that creates and returns this instance. it is throwing System.MethodAccessException.

My question is, is this even possible?, and how does it work? by doing this in IL, il.Emit(Opcodes.call, methodInfo), in the call that creates the .exe, when in runtime, how does he know what method to call? does the method that i want to call, go to the .exe assembly? im very confused by this.. thanks in advance, sorry for my stuppidity, im very new to this reflection





Aucun commentaire:

Enregistrer un commentaire