I have array string format (hh.mm)
How sum ?
I use extensions:
static class SumExtensions
{
public static String Sum<T>(this IEnumerable<T> source, Func<T, String> selector)
{
return source.Select(selector).Aggregate((x, y) => x + y);
}
}
but I do not understand where parse string and sum
First of all, you need to convert the
stringto theTimeSpanrepresentation.It is necessary because the
TimeSpanrepresentation allows to perform arithmetic operations for time intervals.The variable
sumTimeSpancontains the result.