Click here to Skip to main content
15,919,245 members

Comments by alimahdipour (Top 4 by date)

alimahdipour 25-Oct-11 3:26am View    
my book is "LINQ in Action" and i do not think this is funk, maybe my question is not clear and understandable because i am new to linq.
thanks.
alimahdipour 24-Oct-11 4:16am View    
Excuse me SAKryukov , my error is like below:

Error 1 The type arguments for method 'System.Linq.Queryable.Where<tsource>(System.Linq.IQueryable<tsource>, System.Linq.Expressions.Expression<system.func<tsource,int,bool>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Actually in the book, I am studying; there is one code for linq to objects like below that is working, just in my previous code i liked to change the code in the book:
1- Linq to sql (northwind) instead of linq to objects.
2- Using text boxes instead of constant value.
3- Using Queryable instead of Enumerable.

Please help what changes I have to do in expression tree.
Thanks a lot.

The code in the book:

var book = Expression.Parameter(typeof(Book), "book");
var titleExpression = Expression.NotEqual(
Expression.Property(book, "Title"),
Expression.Constant("Funny Stories"));
var pageCountExpression = Expression.GreaterThan(
Expression.Property(book, "PageCount"),
Expression.Constant(100));
var andExpression = Expression.And(titleExpression,
pageCountExpression);
var predicate = Expression.Lambda(andExpression, book);
var query = Enumerable.Where(SampleData.Books,
(Func<book, boolean="">)predicate.Compile());
alimahdipour 16-Oct-11 8:56am View    
Thanks gentleman it gives me very good idea . If I could have some more reference, book address, tutorial or address of sample application about what you mentioned was very helpful.

Thanks in advanced.
alimahdipour 15-Oct-11 10:56am View    
Thanks I have searched a lot in Google before but i could not find that. actually i think my "key words" for searching are not correct.please address me one link or good "key word" for searching this title in Google.
thanks in advanced.