mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
perf: Potential optimization when searching for Constructors/Methods
This commit is contained in:
parent
c1418ae4e2
commit
b29ae4c8c8
1 changed files with 9 additions and 1 deletions
|
|
@ -51,7 +51,15 @@ namespace ICD.Common.Utils
|
|||
if (parameters == null)
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue