What's the difference between MethodHandle.GetFunctionPointer and Marshal.GetFunctionPointerForDelegate
as stated above I need to know what the difference is between this two possibilities when trying to pass a delegate as a callback to a native DLL. I sometimes have to use the first one and sometimes the second one for my code to work. However, it is unclear to me what's the difference and when to use which possibi开发者_运维技巧lity.
Please enlighten me ;)
To my knowledge, MethodHandle.GetFunctionPointer
would be used when you have a MethodInfo
object to start with. GetFunctionPointerForDelegate
, on the other hand, would be used when you have a delegate to begin with.
精彩评论