I have a LINQ query that looks like this...
var duration = Level3Data.AsQueryable().Sum(d => d.DurationMonths);
If all the d.DurationMonths
values are null the Sum returns 0
. How can I make the Sum return null
if all the d.DurationMonths
are null
? Or do I need to run a separate query first to eliminate this situation before performing the sum?