GooglePrettify

2018年4月9日 星期一

Dynamic call static method

Just
Type.GetType(typeName).GetMethod(methodName).Invoke(null, arguments);
where typeName is the name of the type as a string, methodName is the name of the method as a string, and arguments is an array of objects containing the arguments to call the method with.

from : https://stackoverflow.com/questions/1418209/calling-a-method-on-a-static-class-given-its-type-name-and-method-names-as-stri

沒有留言:

張貼留言