George George

George George

  • NA
  • 778
  • 0

reflection method

Sep 7 2008 11:06 PM

Hello everyone,


Sometimes I saw code which does not store reflection data structure MethodInfo, but stores MethodHandle each time and converts MethodHandle to MethodInfo (using GetMethodFromHandle) when MethodInfo is used to invoke the specific method using reflection.

My understanding is,

1. Using method handle could save memory;
2. But each time doing conversion from method handle to method info uses additional time.

So, it is a memory footprint/performance trade-off of choosing method info and method handle.

My questions is whether my above understanding of whether to use method handle or method info is correct. If not, what are the correct points?


thanks in advance,
George


Answers (5)