79831578

Date: 2025-11-27 09:52:18
Score: 1
Natty:
Report link

I was faced with the task of sorting data by one of two dates depending on the unit's status.

var date = DateTime.UtcNow;
items = items.OrderBy(x => x.StatusId != 1)
             .ThenBy(x => x.StatusId == 1 ? x.Date : date)
             .ThenByDescending(x => x.Created);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Andrii Fast