diff --git a/ICD.Common.Utils/ReflectionUtils.cs b/ICD.Common.Utils/ReflectionUtils.cs index 514910d..cbdda24 100644 --- a/ICD.Common.Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/ReflectionUtils.cs @@ -51,13 +51,7 @@ namespace ICD.Common.Utils if (parameters == null) throw new ArgumentNullException("parameters"); -#if SIMPLSHARP - IEnumerable -#else - IEnumerable -#endif - parameterTypes = method.GetParameters().Select(p => p.ParameterType); - + IEnumerable parameterTypes = method.GetParameters().Select(p => (Type)p.ParameterType); return ParametersMatchTypes(parameterTypes, parameters); } @@ -81,13 +75,7 @@ namespace ICD.Common.Utils /// /// /// - private static bool ParametersMatchTypes( -#if SIMPLSHARP - IEnumerable -#else - IEnumerable -#endif - types, IEnumerable parameters) + private static bool ParametersMatchTypes(IEnumerable types, IEnumerable parameters) { if (types == null) throw new ArgumentNullException("types"); @@ -95,27 +83,11 @@ namespace ICD.Common.Utils if (parameters == null) throw new ArgumentNullException("parameters"); + return types #if SIMPLSHARP - IList -#else - IList + .Cast() #endif - typesArray = types as -#if SIMPLSHARP - IList -#else - IList -#endif - ?? types.ToArray(); - - IList parametersArray = parameters as IList ?? parameters.ToArray(); - - if (parametersArray.Count != typesArray.Count) - return false; - - // Compares each pair of items in the two arrays. - return !parametersArray.Where((t, index) => !ParameterMatchesType(typesArray[index], t)) - .Any(); + .SequenceEqual(parameters, (a, b) => ParameterMatchesType((Type)a, b)); } /// @@ -164,7 +136,7 @@ namespace ICD.Common.Utils } /// - /// Platform independant delegate instantiation. + /// Platform independent delegate instantiation. /// /// ///