System.Linq.Expressions.Error.MethodWithMoreThanOneMatch C# (CSharp) Méthode

MethodWithMoreThanOneMatch() static private méthode

InvalidOperationException with message like "More than one method '{0}' on type '{1}' is compatible with the supplied arguments."
static private MethodWithMoreThanOneMatch ( object p0, object p1 ) : Exception
p0 object
p1 object
Résultat System.Exception
        internal static Exception MethodWithMoreThanOneMatch(object p0, object p1)
        {
            return new InvalidOperationException(Strings.MethodWithMoreThanOneMatch(p0, p1));
        }
        /// <summary>

Usage Example

        //CONFORMING
        private static MethodInfo FindMethod(Type type, string methodName, Type[] typeArgs, Expression[] args, BindingFlags flags)
        {
            MemberInfo[] members = type.FindMembers(MemberTypes.Method, flags, Type.FilterNameIgnoreCase, methodName);
            if (members == null || members.Length == 0)
            {
                throw Error.MethodDoesNotExistOnType(methodName, type);
            }

            MethodInfo method;

            var methodInfos = members.Map(t => (MethodInfo)t);
            int count       = FindBestMethod(methodInfos, typeArgs, args, out method);

            if (count == 0)
            {
                throw Error.MethodWithArgsDoesNotExistOnType(methodName, type);
            }
            if (count > 1)
            {
                throw Error.MethodWithMoreThanOneMatch(methodName, type);
            }
            return(method);
        }
Error