title: How to calculate average of some timespans in C#
body: <p>I already search this question but unfortunately couldn't find proper answer.</p>
  
  <p>I want to calculate the average of time spent on doing something in 10 different day and I have 10 <code>datetimepicker</code> for start time and also 10 <code>datetimepicker</code> for end time for each day (in total 20 <code>datetimepicker</code>).</p>
  
  <p>now I want to get the average of time spent for work in these 10 days.</p>
  
  <p>this is what I've done for calculating <code>timespan</code> in each day and now I don't know how to calculate average if these <code>timespans</code></p>
  
  <p>of course I want to know is there any shorter way to get the job done?</p>
  
  <pre><code>DateTime Dt1 = dateTimePicker1.Value;
  DateTime Dt2 = dateTimePicker2.Value;
  .
  .
  .
  DateTime Dt20 = dateTimePicker20.Value;
  
  TimeSpan Day1 = DateTime.Parse(Dt11.TimeOfDay.ToString()).Subtract(DateTime.Parse(Dt1.TimeOfDay.ToString()));
  TimeSpan Day2 = DateTime.Parse(Dt12.TimeOfDay.ToString()).Subtract(DateTime.Parse(Dt2.TimeOfDay.ToString()));
  .
  .
  .
  
  TimeSpan Day10 = DateTime.Parse(Dt20.TimeOfDay.ToString()).Subtract(DateTime.Parse(Dt10.TimeOfDay.ToString()));
  </code></pre>
  
  <p>I want to find average of Day1 to Day10</p>