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

PropertyNotDefinedForType() static private méthode

ArgumentException with message like "Property '{0}' is not defined for type '{1}'"
static private PropertyNotDefinedForType ( object p0, object p1, string paramName ) : Exception
p0 object
p1 object
paramName string
Résultat Exception
        internal static Exception PropertyNotDefinedForType(object p0, object p1, string paramName)
        {
            return new ArgumentException(Strings.PropertyNotDefinedForType(p0, p1), paramName);
        }
        /// <summary>

Usage Example

        public static ConditionalMemberCSharpExpression ConditionalProperty(Expression expression, PropertyInfo property)
        {
            RequiresCanRead(expression, nameof(expression));
            ContractUtils.RequiresNotNull(property, nameof(property));

            if (!property.CanRead)
            {
                throw Error.ConditionalAccessRequiresReadableProperty();
            }

            if (property.GetIndexParameters().Length != 0)
            {
                throw Error.ConditionalAccessRequiresReadableProperty();
            }

            if (property.GetGetMethod(true).IsStatic)
            {
                throw Error.ConditionalAccessRequiresNonStaticMember();
            }

            var type = expression.Type.GetNonNullReceiverType();

            if (!TypeUtils.IsValidInstanceType(property, type))
            {
                throw LinqError.PropertyNotDefinedForType(property, type);
            }

            return(ConditionalMemberCSharpExpression.Make(expression, property));
        }
All Usage Examples Of System.Linq.Expressions.Error::PropertyNotDefinedForType
Error