예제 #1
0
        public override MethodBase SelectMethod(
            BindingFlags bindingAttr,
            MethodBase[] matchMethods,
            Type[] parameterTypes,
            ParameterModifier[] modifiers)
        {
            for (int i = 0; i < matchMethods.Length; ++i)
            {
                if (matchMethods[i].IsGenericMethodDefinition != _genericMethodDefinition)
                {
                    continue;
                }

                ParameterInfo[] pis   = matchMethods[i].GetParameters();
                bool            match = (pis.Length == parameterTypes.Length);

                for (int j = 0; match && j < pis.Length; ++j)
                {
                    match = TypeExtensions.CompareParameterTypes(pis[j].ParameterType, parameterTypes[j]);
                }

                if (match)
                {
                    return(matchMethods[i]);
                }
            }

            return(null);
        }