var TravelRoute = MyData.TravelRouteByName(
parameters.Directions
.Where(p => p.TravelRouteId != null)
.Select(p => p.TravelRouteId.Value)
.Distinct()
.ToArray());
I have the sample linq query above. If Directions
is null, it will through an exception that ""
Value cannot be null.\r\nParameter name: source
What would be the best way of handling such situations such that no exception is thrown?