Exemplo n.º 1
0
        private ListBuilder <MethodInfo> GetMethodCandidates(
            String name, int genericParameterCount, BindingFlags bindingAttr, CallingConventions callConv,
            Type[] types, bool allowPrefixLookup)
        {
            bool           prefixLookup, ignoreCase;
            MemberListType listType;

            RuntimeType.FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType);

#if MONO
            RuntimeMethodInfo[] cache = GetMethodsByName(name, bindingAttr, listType, this);
#else
            RuntimeMethodInfo[] cache = Cache.GetMethodList(listType, name);
#endif

            ListBuilder <MethodInfo> candidates = new ListBuilder <MethodInfo>(cache.Length);
            for (int i = 0; i < cache.Length; i++)
            {
                RuntimeMethodInfo methodInfo = cache[i];
                if (genericParameterCount != GenericParameterCountAny && genericParameterCount != methodInfo.GenericParameterCount)
                {
                    continue;
                }

                if (FilterApplyMethodInfo(methodInfo, bindingAttr, callConv, types) &&
                    (!prefixLookup || RuntimeType.FilterApplyPrefixLookup(methodInfo, name, ignoreCase)))
                {
                    candidates.Add(methodInfo);
                }
            }

            return(candidates);
        }