Start New Discussion within our Software Development Community

I got yesterday a question how to get average date from list of dates, and here's my answer.

definitely, sum of ticks.
static void Main(string[] args)
//Initializes new List of DataTime Object.
            List<DateTime> dates = new List<DateTime>();
//Fills the List of DateTime Object. 
            for (int i = 0; i < 5; i++)
                dates.Add(DateTime.Now); //Adds new DataTime Object in the list of DateTime Object.
                Thread.Sleep(1000);//stop filling dates for one second
//Prints the List of DataTime Object.
            for (int i = 0; i < 5; i++)
//Calls the method to get the average DataTime Object.

        static void GetAverageDateTime(List<DateTime> dates)
//Total number of Ticks
            long totalTicks = 0; 
//Average number of Ticks
            long averageTicks = 0;
//Gets the total of the List of DateTime Object Ticks.
            for (int i = 0; i < dates.Count; i++)
                totalTicks += dates[i].Ticks;
//Gets the average of Ticks (Average is the total divided by the number :))
            averageTicks = totalTicks / dates.Count;
//Initializes new DateTime Object by the AverageTick object.
            DateTime averageDate = new DateTime(averageTicks);
//Prints it to the user            
            Console.WriteLine(string.Format("Average date {0}", averageDate));
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.