System.Linq.Expressions.Expression.ValidateElementInitAddMethodInfo C# (CSharp) Méthode

ValidateElementInitAddMethodInfo() private static méthode

private static ValidateElementInitAddMethodInfo ( MethodInfo addMethod, string paramName ) : void
addMethod MethodInfo
paramName string
Résultat void
        private static void ValidateElementInitAddMethodInfo(MethodInfo addMethod, string paramName)
        {
            ValidateMethodInfo(addMethod, paramName);
            ParameterInfo[] pis = addMethod.GetParametersCached();
            if (pis.Length == 0)
            {
                throw Error.ElementInitializerMethodWithZeroArgs(paramName);
            }
            if (!addMethod.Name.Equals("Add", StringComparison.OrdinalIgnoreCase))
            {
                throw Error.ElementInitializerMethodNotAdd(paramName);
            }
            if (addMethod.IsStatic)
            {
                throw Error.ElementInitializerMethodStatic(paramName);
            }
            foreach (ParameterInfo pi in pis)
            {
                if (pi.ParameterType.IsByRef)
                {
                    throw Error.ElementInitializerMethodNoRefOutParam(pi.Name, addMethod.Name, paramName);
                }
            }
        }
    }
Expression