What is the difference between MethodHandle.GetFunctionPointer and Marshal.GetFunctionPointerForDelegate

as stated above, I need to know what is the difference between these two features when trying to pass a delegate as a callback to my native DLL. I sometimes have to use the first, and sometimes the second for my code. However, I do not understand what the difference is and when to use this opportunity.

Please enlighten me;)

+3
source share
1 answer

As far as I know, MethodHandle.GetFunctionPointerwill be used when you have an object MethodInfoto start with. GetFunctionPointerForDelegate, on the other hand, will be used when you have a delegate to start with.

+1
source

Source: https://habr.com/ru/post/1773061/


All Articles