Note
If a matching method could be found and the invocation itself has thrown an exception, then this method also throws an exception instead of returning .
public static bool TryInvokeMethod(
Type type,
string methodName,
bool ignoreCase,
out Object?? result,
params Object?[]? parameters
)Public Shared Function TryInvokeMethod (
type As Type,
methodName As String,
ignoreCase As Boolean,
<OutAttribute> ByRef result As Object,
ParamArray parameters As Object()
) As Booleanpublic:
static bool TryInvokeMethod(
Type^ type,
String^ methodName,
bool ignoreCase,
[OutAttribute] Object^% result,
... array<Object^>^ parameters
)static member TryInvokeMethod :
type : Type *
methodName : string *
ignoreCase : bool *
result : Object byref *
parameters : Object[] -> bool methodName can refer public and non-public methods. To avoid ambiguity this method gets all the methods of the same name and chooses the first one for which the provided parameters match.
If you already have a MethodInfo instance use the InvokeMethod(Object, MethodInfo, Type, ReflectionWays, Object) method for better performance.
For invoking the method this method uses the DynamicDelegate reflection way.