System.Dynamic.Utils.TypeExtensions.MatchesArgumentTypes C# (CSharp) Method

MatchesArgumentTypes() private static method

Returns true if the method's parameter types are reference assignable from the argument types, otherwise false. An example that can make the method return false is that typeof(double).GetMethod("op_Equality", ..., new[] { typeof(double), typeof(int) }) returns a method with two double parameters, which doesn't match the provided argument types.
private static MatchesArgumentTypes ( this mi, Type argTypes ) : bool
mi this
argTypes Type
return bool
        private static bool MatchesArgumentTypes(this MethodInfo mi, Type[] argTypes)
        {
            if (mi == null || argTypes == null)
            {
                return false;
            }
            ParameterInfo[] ps = mi.GetParameters();

            if (ps.Length != argTypes.Length)
            {
                return false;
            }

            for (int i = 0; i < ps.Length; i++)
            {
                if (!TypeUtils.AreReferenceAssignable(ps[i].ParameterType, argTypes[i]))
                {
                    return false;
                }
            }
            return true;
        }