private static void SortAndDisplayList(List <int> numbersToSort, int userChoiceOfAlgorithm) { Isorter sorter = AlgorithmsUtilities.FindSortingAlgorithmBasedOn(userChoiceOfAlgorithm); List <int> result = new List <int>(0); if (sorter != null) { result = sorter.Sort(numbersToSort); } DisplayTheSortedList(result); }
private static void TakeUserInput(ref int userChoiceOfAlgorithm, out List <int> numbersToSort) { Console.WriteLine("Choose the index of the algorithm from the following: \n" + AlgorithmsUtilities.FindAlgorithmsNames()); Int32.TryParse(Console.ReadLine(), out userChoiceOfAlgorithm); if (userChoiceOfAlgorithm < 1 || userChoiceOfAlgorithm > AlgorithmsUtilities.AlgorithmsCount) { userChoiceOfAlgorithm = 1; } numbersToSort = TakeInputOfNumbersToSort(); }