ElementInitializerMethodStatic() статический приватный Метод

ArgumentException with message like "Element initializer method must be an instance method"
static private ElementInitializerMethodStatic ( string paramName ) : Exception
paramName string
Результат System.Exception
Пример #1
0
        private static void ValidateElementInitAddMethodInfo(MethodInfo addMethod)
        {
            ValidateMethodInfo(addMethod);
            var pis = addMethod.GetParameters();

            if (pis.Length == 0)
            {
                throw Error.ElementInitializerMethodWithZeroArgs();
            }
            if (!addMethod.Name.Equals("Add", StringComparison.OrdinalIgnoreCase))
            {
                throw Error.ElementInitializerMethodNotAdd();
            }
            if (addMethod.IsStatic)
            {
                throw Error.ElementInitializerMethodStatic();
            }
            foreach (var pi in pis)
            {
                if (pi.ParameterType.IsByRef)
                {
                    throw Error.ElementInitializerMethodNoRefOutParam(pi.Name, addMethod.Name);
                }
            }
        }