public static void BenchmarkSort(ISortable <int> sortable, int[] dataSizes) { foreach (var size in dataSizes) { var data = GenUnsortedIntArray(size); var stopwatch = new Stopwatch(); stopwatch.Start(); var ret = sortable.sort(data); stopwatch.Stop(); if (!IsIntArraySorted(ret)) { throw new SystemException("Sort algorithm is not correctly implemented"); } Console.WriteLine("data size: {0:n0}, elapsed: {1}", data.Length, FormatElapsed(stopwatch.Elapsed)); } }