how to know the number and type of parameters?
how to know the return type?
how to check whether the return type is void?
how to know the number and type of parameters?
how to know the return type?
how to check whether the return type is void?
Use MethodInfo.ReturnType
to determine the return type, and MethodBase.GetParameters()
to find out about the parameters. (MethodInfo
derives from MethodBase
, so once you've got the MethodInfo
via Type.GetMethod
etc, you can use both ReturnType
and GetParameters()
.)
If the method is void, the return type will be typeof(void)
:
if (method.ReturnType == typeof(void))