Compare nullable types in Linq to Sql

Other way:

Where object.Equals(c.ParentId, categoryId)

or

Where (categoryId == null ? c.ParentId == null : c.ParentId == categoryId)

Leave a Comment