System.Linq.Expressions.Error.PropertyDoesNotHaveAccessor C# (CSharp) Метод

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

ArgumentException with message like "The property '{0}' has no 'get' or 'set' accessors"
static private PropertyDoesNotHaveAccessor ( object p0, string paramName ) : Exception
p0 object
paramName string
Результат Exception
        internal static Exception PropertyDoesNotHaveAccessor(object p0, string paramName)
        {
            return new ArgumentException(Strings.PropertyDoesNotHaveAccessor(p0), paramName);
        }
        /// <summary>

Usage Example

Пример #1
0
        public static MemberExpression Property(Expression expression, PropertyInfo property)
        {
            ContractUtils.RequiresNotNull(property, "property");

            MethodInfo mi = property.GetGetMethod(true) ?? property.GetSetMethod(true);

            if (mi == null)
            {
                throw Error.PropertyDoesNotHaveAccessor(property);
            }

            if (mi.IsStatic)
            {
                ContractUtils.Requires(expression == null, "expression", Strings.OnlyStaticPropertiesHaveNullInstance);
            }
            else
            {
                ContractUtils.Requires(expression != null, "property", Strings.OnlyStaticPropertiesHaveNullInstance);
                RequiresCanRead(expression, "expression");
                if (!TypeUtils.IsValidInstanceType(property, expression.Type))
                {
                    throw Error.PropertyNotDefinedForType(property, expression.Type);
                }
            }
            return(MemberExpression.Make(expression, property));
        }
All Usage Examples Of System.Linq.Expressions.Error::PropertyDoesNotHaveAccessor
Error