Other way:
Where object.Equals(c.ParentId, categoryId)
or
Where (categoryId == null ? c.ParentId == null : c.ParentId == categoryId)
More Related Contents:
- Linq query with nullable sum
- Returning IEnumerable vs. IQueryable
- Nullable types and the ternary operator: why is `? 10 : null` forbidden? [duplicate]
- What is the syntax for an inner join in LINQ to SQL?
- Random row from Linq to Sql
- What is the difference between Nullable.HasValue or Nullable != null?
- C# elegant way to check if a property’s property is null
- LINQ to SQL: Multiple joins ON multiple Columns. Is this possible?
- Understanding .AsEnumerable() in LINQ to SQL
- How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?
- LINQ Left Join And Right Join
- Persist Data by Programming Against Interface
- LINQ Where Ignore Accentuation and Case
- Ternary operator VB vs C#: why resolves Nothing to zero? [duplicate]
- In C# why can’t a conditional operator implicitly cast to a nullable type
- nullable object must have a value
- C# LINQ to SQL: Refactoring this Generic GetByID method
- Where in memory are nullable types stored?
- LINQ to SQL using GROUP BY and COUNT(DISTINCT)
- How is the boxing/unboxing behavior of Nullable possible?
- Will using LINQ to SQL help prevent SQL injection
- Type result with conditional operator in C#
- What is the default value of the nullable type “int?” (including question mark)?
- Last and LastOrDefault not supported
- How to get nullable DateTime out of the database
- Linq “Could not translate expression… into SQL and could not treat it as a local expression.”
- Correct way to check if a type is Nullable [duplicate]
- Serializing a Nullable in to XML
- Explicit construction of entity type [MyClass] in query is not allowed
- Is Injection Possible through Dynamic LINQ?