You can create new LINQ expressions containing old expressions.
var loc = (from l in Entity.Locations select l); if (hasLocation) loc = loc.Where(a => a.LocationId > 5); if (hasName) loc = loc.Where(a => a.Name == "bla");
The expression is only evaluated once you use it, like
var result = loc.ToList();
- Build dynamic linq to Sql lambda expression
- How to build a dynamic AND OR linq expression tree in a loop
- Looking for simple way to build Linq dynamic / conditional expression
- How to create dynamic lambda based Linq expression from a string in C#?
- Build lambda expression (predicate) with dynamic comparison operators
- How to build a dynamic linq expression tree in a loop
- Build LINQ Lambda Expression with contains method for enum property with list of int
- Dynamic Linq Where with Lambda Expression generates Error
- Dynamic query in linq or lambda expression C#
- Build Dynamic Expression For Linq Where using PropertyInfo and a value
- "Or" equivalent in Linq Where() lambda expression
- Like in Lambda Expression and LINQ
- What is the Efficiency and Performance of LINQ and Lambda Expression in .Net?
- How Build Lambda Expression Tree with multiple conditions
- Selecting multiple columns with linq query and lambda expression
- convert this LINQ expression into Lambda
- Can you reverse order a string in one line with LINQ or a LAMBDA expression
- What is equivalent to clause between, for comparasion strings in LINQ or lambda expression of?
- C# linq expression in lambda with contains
- Dynamic LINQ and Dynamic Lambda expressions?
- Comparison : LINQ vs LAMBDA Expression
- Concatenate two column values in LinQ Lambda Expression
- Using a LINQ ExpressionVisitor to replace primitive parameters with property references in a lambda expression
- Equivalent of SQL Between Statement Using Linq or a Lambda expression
- passing dynamic expression to order by in code first EF repository
- LINQ naming Standard - Lambda Expression
- How can I build Linq query with dynamic OR statements?
- C# LINQ build expression with anonymous type
- Difference between LINQ Queries & Lambda expression
- What is the equivalent of XML PATH and Stuff in Linq lambda expression (GROUP_CONCAT/STRING_AGG)?
- Linq object Enumeration
- Cannot implicitly convert type 'System.Collection.Generic.IEnumerable<string>' to 'string' while Adding data to the ViewModel
- C#: Func<> instead of methods?
- Custom Extension-Function to implement "IN" in c# (LINQ-2-Entities)
- Batchify long Linq operations?
- C# and XPath with wildcard attribute name and specific attribute value
- Select using linq based on 2 conditions
- Receiving Object reference not set to an instance of an object. on simple datetime retrieval from Raven
- MVC3 Binding model (some fields) to the view
- How to check string for null and assign its value in the same line
- Difference between lambda and LINQ?
- Why is Entity Framework having performance issues when calculating a sum
- EF5 InverseProperty Issue
- NHibernate produce System.ArgumentException
- Linq to Entities : how to handle null values in database with a contains
- Is there a LINQ equivalent of string.Join(string, string)
- How to use Select in dynamic list?
- Linq - Locally Distinct
- select sum columns from diffrent table using linq
- Case insensitive .contains for delegates?