score:4
var query = // some core query
if(s == null) { query = query.Where(x => x.Foo == null); }
else { query = query.Where(x => x.Foo == s); }
Source: stackoverflow.com
Related Query
- Querying using NULL on varchar column
- Querying XML with LINQ and using null in place of a particular xml attribute if it does not exist
- Exclude null values while summation by specific column in a left joined table using LINQ
- How do I check if a SQL Server 2005 TEXT column is not null or empty using LINQ To Entities?
- Getting DataTable column names using linq, error when column is null
- Can't insert NULL into varbinary column using LINQ
- When querying a collection using linq it always returns a null
- How to retrieve column names which are byte and not null in C# json web service using LINQ class?
- Update List column values, if value is null using Linq
- How to query a date range from a varchar column using LINQ
- How do I check for a null value in a tuple or single value in a column using LINQ for Entity Framework?
- When querying a collection using linq it always returns a null
- using LINQ query to get max of a varchar column
- Not able to retrieve sum of varchar column using LINQ in c#
- LINQ order by null column where order is ascending and nulls should be last
- Get all column names of a DataTable into string array using (LINQ/Predicate)
- How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?
- Select All distinct values in a column using LINQ
- How to handle NULL object property with FirstOrDefault using Linq
- Linq where column == (null reference) not the same as column == null
- Using Linq's Where/Select to filter out null and convert the type to non-nullable cannot be made into an extension method
- Exclude a column from a select using LINQ
- How to return null if using SingleOrDefault() and searching a list of numbers for a number not in list?
- C# Using Linq to get column from jagged array
- Querying a timestamp column from LINQ to SQL
- Using LINQ to get DataGridView row index where first column has specific value
- Linq: Checking if string column has a value (ie. is not null or empty)
- How to query if array is null or empty using MongoDB and C# Driver?
- Obtain first string in an array which is not null using LINQ?
- Combine tables using row values as column LINQ C# SQL
More Query from same tag
- How I get RowNumber with Model In Entity Framework core
- Findall items in one list matching items in another list's VB.Net
- MVC 5 unable to create controller with Linq to SQL class
- Make Reachable Class Out Of DataTable LINQToDataTable<T>()?
- LINQ & IEnumerable<String> Re-evaluation
- Compare char in linq
- Linq groupby performance issue
- Sequence contains no elements
- Getting data from multiple tables (C# Entity), linked by foreign keys, converted to anonymous object
- How to change the order of the list?
- How do I return NULL values after performing a LEFT JOIN in LINQ?
- Grouping in Elastic Search
- LINQ Select within a Select
- Linq using sum() in list within a list
- How to match the results back to an array
- Why is my linq alias out of scope?
- C# - Combine multiple LINQ collections with same properties
- Linq query to join two objects and calculate sum
- ThenBy fails after Select
- How to Change database name in Linq Vb.net
- LINQ query to find common strings between two collections
- How I get the Attributevalue from a Xml to a Array with Linq to XML?
- Why LINQ returns other column value than expected?
- List.OrderByDescending results in duplicates
- sorting Grid View column with foreign key to different entity using LINQto SQL
- Linq sort child in query
- LINQ Left Join 3 tables with OR operator
- What is the most efficient way to select an XML value based on one of its associative attributes using C#
- Adding OR to my LINQ query?
- LINQ SUM with Inner Joins: How to get the Sum for a TimeSpan