expression-trees

Is there a 3rd party library that knows to convert a linq expression to a human readable string representation?

I have a linq expression and I wish to display it in the log in a human readable form. Any one knows any library that can do it? I saw this entry http://stackoverflow.com/questions/3294438/creating-a-string-from-a-lambda-expression, but it is not that useful, in my opinion. Thanks. EDIT Now that I think about it, my case is probably n...

Like operator in Expression Tree

I have a Linq extension method to dynamically filter Linq queries using string values. For example: query.WhereHelper("columName", ">", 1). I could use many different filter operators like GreaterThan or NotEqual etc. but not "Like". There is no Expression.Like or Expression.StartsWith etc. How can I implement Like operator to my Express...

My Expression Tree isnt storing objects correctly :(

So Im trying to input a postfix expression that is stored in a queue into an expression tree. When i send the queue to my build(QueueLi postfix) method, it works fine until the elseif(isOperator(token)) statement takes the operator and attaches the two operands from the stack and pushes it into the stack. I tried printing the element aft...

Parsing Expression Tree with BinaryExpression AND

hello... I'm just in the early process of learning about expression trees. As far as I understand, the good thing about them is that they can be parsed when they are used as parameters, so for instance: Foo.Bar(x => x.Process == "On" && x.Name == "Goofy") But how can I parse the expression when there is AND inside? Maybe I've misund...

manually build linq expression for x => x.Child == itemToCompare.Child

We have an object and we want to build a linq query based on that object on the fly. This linq statement is equivalent to what we want to build: Expression<Func<Sample, bool>> linqExpression = x => x.Child == itemToCompare.Child; We can't quite come up with the right expression to build the itemToCompare.Child part. Here'...

BubbleSort Expression Tree

Here is code of BubbleSort method (rewritten by me in better way to design expression tree for it) static void BubbleSort(int[] array) { int i = 0; while (i < array.Length) { int j = i + 1; while (j < array.Length) { if (array[i] > array[j]) ...

PredicateBuilder methods clarification

I looked through PredicateBuilder sources and its' implementation makes me curious. Let's look at Or method implementation: public static Expression<Func<T, bool>> Or<T> (this Expression<Func<T, bool>> expr1, Expression<Func<T, bool>> expr2) { var invokedExpr = Expression.Invok...

Dynamic LINQ with Data Objects

So I have been searching for a simple example to hopefully a simple problem. I have a simple object a List of ListTest (List) public class ListTest{ { public string perName { get; set; } public string perSex { get; set; } public ListTest(string pName, string pSex) { this.perSex = pSex; this.perName = pNa...

Expression.Condition(nullableType.HasValue, new classInstance(){ ... }, null) can it be done some other way?

I am working on a projection utility and have one last (more?) hurdle to clear... Here is the scenario: public class Person { public string FirstName { get; set; } public string LastName { get; set; } public int? AddressID { get; set; } public Address Address { get; set; } public string Otherproperty1 { get; set; } ...

learning expression trees in LINQ

What articles/tutorials can you recommend for LINQ Expression Trees? ...

Turn "fieldname .startsWith. 'fieldValue'" into .Where(p => p.fieldname.StartsWith('fieldValue')) predicate?

I attempted to do this below, with mind blanks as it got complicated. I need to build a predicate to pass to my Product Repository from a client string: "fieldname .startsWith. 'fieldvalue'" "fieldname .contains. 'fieldvalue'" "fieldname .equals. 3" "fieldname .greaterThan. 3" "fieldname .lessThan. 3" The field names could be any exi...