diff --git a/ICD.Common.Utils/ReflectionUtils.cs b/ICD.Common.Utils/ReflectionUtils.cs index cbdda24..2f189ef 100644 --- a/ICD.Common.Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/ReflectionUtils.cs @@ -51,7 +51,15 @@ namespace ICD.Common.Utils if (parameters == null) throw new ArgumentNullException("parameters"); - IEnumerable parameterTypes = method.GetParameters().Select(p => (Type)p.ParameterType); + ParameterInfo[] methodParameters = method.GetParameters(); + + // Bail early if the counts don't match + ICollection parametersCollection = parameters as ICollection; + if (parametersCollection != null && parametersCollection.Count != methodParameters.Length) + return false; + + // Compare the parameters to the objects + IEnumerable parameterTypes = methodParameters.Select(p => (Type)p.ParameterType); return ParametersMatchTypes(parameterTypes, parameters); }