public static bool IsApplicable(ScriptingContext context, TargetFunctionType method, TargetType[] types, out string error) { TargetMethodSignature sig = method.GetSignature (context.CurrentThread); for (int i = 0; i < types.Length; i++) { TargetType param_type = sig.ParameterTypes [i]; if (param_type == types [i]) continue; if (Convert.ImplicitConversionExists (context, types [i], param_type)) continue; error = String.Format ( "Argument {0}: Cannot implicitly convert `{1}' to `{2}'", i, types [i].Name, param_type.Name); return false; } error = null; return true; }
static bool IsApplicable (MdbEvaluationContext ctx, TargetFunctionType method, TargetType[] types, out string error, out int matchCount) { TargetMethodSignature sig = method.GetSignature (ctx.Thread); matchCount = 0; for (int i = 0; i < types.Length; i++) { TargetType param_type = sig.ParameterTypes [i]; if (param_type == types [i]) { matchCount++; continue; } if (TargetObjectConvert.ImplicitConversionExists (ctx, types [i], param_type)) continue; error = String.Format ( "Argument {0}: Cannot implicitly convert `{1}' to `{2}'", i, types [i].Name, param_type.Name); return false; } error = null; return true; }