My current condition is written as follows:
.Where(m => Math.Round((m.DateAndTime - DateTime.Now).TotalMinutes, 0) <= 30 && Math.Round((m.DateAndTime - DateTime.Now).TotalMinutes, 0) > 0)
which basically says where the rounded value is less than or equal to 30
and the rounded value is greater than 0
.
Is there a neater way to write this than having
Math.Round((m.DateAndTime - DateTime.Now).TotalMinutes, 0)
twice in the same statement?
The full expression is:
List<Meeting> finalList = initialList.Where(m => Math.Round((m.DateAndTime - DateTime.Now).TotalMinutes, 0) <= 30 && Math.Round((m.DateAndTime - DateTime.Now).TotalMinutes, 0) > 0).ToList();
0 < value && value <= 30
in those languages that don't allow you to write0 < value <= 30
It makes it much clearer that you're testing for something to be in a specified range. \$\endgroup\$