mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 04:35:00 +00:00
perf: Potential optimization when searching for Constructors/Methods
This commit is contained in:
@@ -51,7 +51,15 @@ namespace ICD.Common.Utils
|
|||||||
if (parameters == null)
|
if (parameters == null)
|
||||||
throw new ArgumentNullException("parameters");
|
throw new ArgumentNullException("parameters");
|
||||||
|
|
||||||
IEnumerable<Type> parameterTypes = method.GetParameters().Select(p => (Type)p.ParameterType);
|
ParameterInfo[] methodParameters = method.GetParameters();
|
||||||
|
|
||||||
|
// Bail early if the counts don't match
|
||||||
|
ICollection<object> parametersCollection = parameters as ICollection<object>;
|
||||||
|
if (parametersCollection != null && parametersCollection.Count != methodParameters.Length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Compare the parameters to the objects
|
||||||
|
IEnumerable<Type> parameterTypes = methodParameters.Select(p => (Type)p.ParameterType);
|
||||||
return ParametersMatchTypes(parameterTypes, parameters);
|
return ParametersMatchTypes(parameterTypes, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user