dynamicmethod

Resolving the tokens found in the IL from a dynamic method

早过忘川 提交于 2019-11-27 18:40:13
问题 Thanks to Hans Passant answering my question here: How do I get an IL bytearray from a DynamicMethod? I was able to get up and running. I am now trying to resolve the Metadata tokens found in the IL emitted, to see what methods are being called, or what not. I am able to resolve that the next token in the method body is a call. I'm using some code from Mono.Reflection 's MethodBodyReader. static byte[] GetILByteArray(Delegate @delegate){ // does stuff mentioned in other thread } ...

How to use SuperObject to invoke methods that uses an Object as parameter in Delphi?

北慕城南 提交于 2019-11-27 18:11:34
问题 We can use the SuperObject library to invoke methods of a certain object by its name and giving its parameters as a json string using the SOInvoker method like in this answer I'd like to know how do I send a created object as a parameter. I tried to send it like LObjectList := TObjectList.Create; LSuperRttiCtx := TSuperRttiContext.Create; LSuperObjectParameter := LObjectList.ToJson(LSuperRttiCtx); SOInvoke(MyInstantiatedObject, 'MyMethod', LSuperObjectParameter); but inside MyMethod the