What is the difference between calling a delegate directly, using DynamicInvoke, and using DynamicInvokeImpl?

后端 未结 3 761
心在旅途
心在旅途 2020-12-14 01:36

The docs for both DynamicInvoke and DynamicInvokeImpl say:

Dynamically invokes (late-bound) the method represented by the current delegate.

3条回答
  •  萌比男神i
    2020-12-14 02:14

    Really there is no functional difference between the two. if you pull up the implementation in reflector, you'll notice that DynamicInvoke just calls DynamicInvokeImpl with the same set of arguments. No extra validation is done and it's a non-virtual method so there is no chance for it's behavior to be changed by a derived class. DynamicInvokeImpl is a virtual method where all of the actual work is done.

提交回复
热议问题