I've seen examples of how to convert a string
to a TimeSpan
, here is one example:
How to Convert string "07:35" (HH:MM) to TimeSpan
But what is the most efficient way to convert a List<string>
to List<TimeSpan>
?
I've tried something along these lines, but isn't working:
var result = new TimeSpan;
var appointmentStartTimesConverted = appointmentStartTimes
.Select(i => result = TimeSpan.TryParse(i, out result))
.ToList();