Skip to main content
added 236 characters in body
Source Link
Austin Salonen
  • 50.4k
  • 16
  • 112
  • 140
(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; } 
(from pro in Products.ToList() let max = pro.DateSend > pro.DateEdit ? pro.DateSend : pro.DateEdit select max).Max() 
(from pro in Products.ToList() let max = Max(pro.DateSend, pro.DateEdit) select max).Max() static DateTime? Max(DateTime? a, DateTime? b) { if (!a.HasValue && !b.HasValue) return a; // doesn't matter     if (!a.HasValue) return b; if (!b.HasValue) return a; return a.Value > b.Value ? a : b; } 
Source Link
Austin Salonen
  • 50.4k
  • 16
  • 112
  • 140

(from pro in Products.ToList() let max = pro.DateSend > pro.DateEdit ? pro.DateSend : pro.DateEdit select max).Max()