4 votes

"Select followed by First" versus "First followed by Select" when summing the data for a student

Option 1 students .Select(x => new { Id = x.Id, Sum = x.Data.SelectMany(n => n).Sum() }) .FirstOrDefault(s => s.Id == 1) .Sum; ...
user avatar
  • 5,750
4 votes
Accepted

Calculate the number of people occupied at each time interval

Generally, at the edge of your program you shouldn't be entering datetimes as timestamp numeric literals, but as human-legible datetimes. On the inside of your program, you also shouldn't be ...
user avatar
  • 49.5k

Only top scored, non community-wiki answers of a minimum length are eligible