(from pro in Products.ToList() let max = Max(pro.DateSend >, pro.DateEdit) select max).Max() static DateTime? proMax(DateTime? a, DateTime? b) { if (!a.DateSendHasValue :&& pro!b.DateEditHasValue) return a; // doesn't matter select max) if (!a.MaxHasValue) return b; if (!b.HasValue) return a; return a.Value > b.Value ? a : b; }