I have a list very similar to this (But example is simplified):
public class TimeEntry
{
public int entrydate { get; set; } //UNIX Timestamp
public string name { get; set; }
public string timespent { get; set; } //Be aware this is a string, not an int or date - [hh]:mm (Hours can go above 24)
}
List<TimeEntry> entryTable = new List<TimeEntry>();
//This layout is fictional and just a representation of my List<TimeEntry>
[entrydate: "1540364988", name: "Time1", timespent: "0:30"],
[entrydate: "1540304400", name: "Time2", timespent: "0:25"],
[entrydate: "1540307400", name: "Time1", timespent: "0:10"],
[entrydate: "1540300010", name: "Time3", timespent: "0:40"],
[entrydate: "1540365000", name: "Time1", timespent: "1:10"],
[entrydate: "1540367500", name: "Time3", timespent: "0:20"],
[entrydate: "1540354500", name: "Time4", timespent: "0:30"]
I would like to combine each entry so they have a total per day for each unique name entry.
So for example
[entrydate: "1540364988", name: "Time1", timespent: "0:30"],
[entrydate: "1540307400", name: "Time1", timespent: "0:10"],
[entrydate: "1540365000", name: "Time1", timespent: "1:10"]
would become
[entrydate: "1540252800", name: "Time1", timespent: "0:10"],
[entrydate: "1540339200", name: "Time1", timespent: "1:40"]
How would I do this in an efficient way? We're talking about 450,000 records, I'm thinking about just using a loop, but having a loop run 450,000 times where in each loop we need to run through all the records we've stored already, just to see if we should count up instead of add a new record sounds inefficient and slow.
No need for full completed code, but I'd love to hear someones opinion or solution on this. Although every little bit of help is appreciated Thanks
EDIT:
Since the question got put on hold for not enough information, here is some more information about my issue:
Goal: Combine each entry from the same day that share the same name
The timestamp is in UTC and a day would be from 00:00:00 to 23:59:99.