private static ISort Execute(int optionValue) { ISort selectedItem; MenuItem menuItem = menuItems[optionValue - 1]; Type classType = menuItem.ClassType; selectedItem = (ISort)Activator.CreateInstance(classType); Console.WriteLine(); string title = $"Executing: {menuItem.Title}"; Console.WriteLine(title); Console.WriteLine(new string('=', title.Length)); int[] array = { }; if (imageList != null) { array = JSONLoader.GetTheArray(1, imageList); } selectedItem.Execute(array, 0, array.Length - 1); if (!(selectedItem is IMenuOption)) { AscendingOrDescending(array); } Console.WriteLine(); Console.WriteLine("Tap something to continue..."); return(selectedItem); }