static void Main(string[] args) { /* Bubble sort algorithm class using STRATEGY pattern using delegation, * passing the IntSortHandler that implements SortHandler interface */ BubbleSorter bubbleSortAlgorithm = new BubbleSorter(new IntSortHandler()); // An unordered array to test the implementation. int[] unOrderedArray = { 2, 5, 8, 2, 1, 98, 34, 2, 3, 5, 6, 8, 2, 1, 0, 56 }; bubbleSortAlgorithm.Sort(unOrderedArray); for (int i = 0; i < unOrderedArray.Length; i++) { Console.WriteLine(unOrderedArray[i]); } // (new ApplicationRunner(new FtoCStrategy())).Run(); }
static void Main(string[] args) { /* Bubble sort algorithm class using STRATEGY pattern using delegation, passing the IntSortHandler that implements SortHandler interface */ BubbleSorter bubbleSortAlgorithm = new BubbleSorter(new IntSortHandler()); // An unordered array to test the implementation. int[] unOrderedArray = { 2, 5, 8, 2, 1, 98, 34, 2, 3, 5, 6, 8, 2, 1, 0, 56 }; bubbleSortAlgorithm.Sort(unOrderedArray); for (int i = 0; i < unOrderedArray.Length; i++) { Console.WriteLine(unOrderedArray[i]); } // (new ApplicationRunner(new FtoCStrategy())).Run(); }