What is the difference between the MethodInfo.Invoke() and Type.InvokeMember() methods?
Which should be used in which scenarios?
Which is the preferred way to invoke a method?
What is the difference between the MethodInfo.Invoke() and Type.InvokeMember() methods?
Which should be used in which scenarios?
Which is the preferred way to invoke a method?
Copyright © 2021 Jogjafile Inc.
Depending upon how you use it,
MethodInfo.Invokecould be faster. When you callType.InvokeMemberunder the covers aMethodInfois retrieved and then invoked. Retrieving aMethodInfois expensive. If you are calling the same method multiple times, saving theMethodInfoin a variable and invoking it from the variable with save time.