private static bool check_arguments (Type[] types, ParameterInfo[] args, bool allowByRefMatch) {
for (int i = 0; i < types.Length; ++i) {
bool match = check_type (types [i], args [i].ParameterType);
if (!match && allowByRefMatch) {
Type param_type = args [i].ParameterType;
if (param_type.IsByRef)
match = check_type (types [i], param_type.GetElementType ());
}
if (!match)
return false;
}
return true;
}