5
Reply

reflection method

Ask a question
George George

George George

16 years ago
2.7k
1

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)