System.Linq.Expressions.Expression.Property C# (CSharp) Method

Property() public static method

Creates an IndexExpression representing the access to an indexed property.
public static Property ( Expression instance, PropertyInfo indexer, IEnumerable arguments ) : IndexExpression
instance Expression The object to which the property belongs. If the property is static/shared, it must be null.
indexer PropertyInfo The that represents the property to index.
arguments IEnumerable An of objects that are used to index the property.
return IndexExpression
        public static IndexExpression Property(Expression instance, PropertyInfo indexer, IEnumerable<Expression> arguments)
        {
            ReadOnlyCollection<Expression> argList = arguments.ToReadOnly();
            ValidateIndexedProperty(instance, indexer, ref argList);
            return new IndexExpression(instance, indexer, argList);
        }

Same methods

Expression::Property ( Expression instance, PropertyInfo indexer ) : IndexExpression
Expression::Property ( Expression instance, string propertyName ) : IndexExpression
Expression::Property ( Expression expression, MethodInfo propertyAccessor ) : MemberExpression
Expression::Property ( Expression expression, PropertyInfo property ) : MemberExpression
Expression::Property ( Expression expression, Type type, string propertyName ) : MemberExpression
Expression::Property ( Expression expression, string propertyName ) : MemberExpression

Usage Example

Ejemplo n.º 1
0
        private static Expression <Func <T, bool> > PrimaryKeyEquals(PropertyInfo property, int value)
        {
            var param = Expression.Parameter(typeof(T));
            var body  = Expression.Equal(Expression.Property(param, property), Expression.Constant(value));

            return(Expression.Lambda <Func <T, bool> >(body, param));
        }
All Usage Examples Of System.Linq.Expressions.Expression::Property
Expression