private static MethodInfo GetAddMethod(Type type, int paramCount, out bool hasMoreThanOne) { MethodInfo result = null; MemberInfo[] addMembers = type.GetMember(KnownStrings.Add, MemberTypes.Method, GetBindingFlags(type)); if (addMembers != null) { foreach (MemberInfo mi in addMembers) { MethodInfo method = (MethodInfo)mi; if (!TypeReflector.IsPublicOrInternal(method)) { continue; } ParameterInfo[] paramInfos = method.GetParameters(); if (paramInfos == null || paramInfos.Length != paramCount) { continue; } if (result != null) { // More than one Add method hasMoreThanOne = true; return(null); } result = method; } } hasMoreThanOne = false; return(result); }
private static MethodInfo GetMethod(Type type, string name, Type[] argTypes) { MethodInfo result = type.GetMethod(name, GetBindingFlags(type), null, argTypes, null); if (result != null && !TypeReflector.IsPublicOrInternal(result)) { result = null; } return(result); }