Here is the query
from a in this._addresses
where a.Street.Contains(street) || a.StreetAdditional.Contains(streetAdditional)
select a).ToList(
You must check first if StreetAdditional
is null
.
Try
where a.Street.Contains(street) || ((a != null) && a.StreetAdditional.Contains(streetAdditional))
This works because &&
is a shortcut-operator and if a != null
yields false, the second expression with the null
-value won't be evaluated since the result will be false
anyway.