Пример #1
0
        private static void DisplaySortCaption <T>(SorterBase <T> sorter, int itemsCount)
            where T : IComparable
        {
            var str = $"`{sorter.SortName}` of collection with {itemsCount} {typeof(T).FullName} elements {Environment.NewLine}";

            Console.WriteLine(str);
        }
Пример #2
0
        private static void PerfromSort <T>(SorterBase <T> sorter, ICollection <T> unsortedCollection,
                                            OutputAction <T> outputAction, bool isAsc)
            where T : IComparable
        {
            DisplaySortCaption(sorter, unsortedCollection.Count);

            outputAction(unsortedCollection, nameof(unsortedCollection));

            sw.Start();
            var sortedCollection = sorter.Sort(unsortedCollection, isAsc);

            sw.Stop();

            outputAction(sortedCollection, nameof(sortedCollection));

            DisplaySortPerformanceResults();
        }