Reuse of a LINQ query

You can store it in a variable. If you are working with IQueryable then use:

System.Linq.Expressions.Expression<Func<Foo, bool>> selector = x => x.Contains("");

If you are using IEnumerable then use:

Func<Foo, bool> selector = x => x.Contains("");

And use it in your query:

query.Where(selector);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)