/* * Note: below factory method design pattern could be used to choose * required sorting logic implementation based on configuration settings */ public static ISort GetSortingLogic(SortingLogic logicName) { if (logicName.Equals(SortingLogic.BubbleSort)) { return(new SortUsingBubbleSort()); } else if (logicName.Equals(SortingLogic.DotNetFramework)) { return(new SortUsingDotNetFramework()); } else { throw new Exception("Unknown logic"); } }
public SortingController() { _sortingLogic = new SortingLogic(); }
static void Main(string[] args) { int[] inputArray = { 10, 5, 15, 18, 19, 42, 15, 32, 99, 100 }; SortingLogic.MergSortingFunction(inputArray); Console.ReadLine(); }