Beispiel #1
0
        public static T?ChooseConsole <T>(this IEnumerable <T> collection, Func <T, string>?getString = null, string?message = null) where T : class
        {
            var cs = new ConsoleSwitch <int, T>(message ?? ConsoleMessage.SelectOneOfTheFollowingOptions.NiceToString());

            cs.Load(collection.ToList(), getString);
            return(cs.Choose());
        }
Beispiel #2
0
        public static T ChooseConsole <T>(this List <T> collection, Func <T, string> getString = null) where T : class
        {
            var cs = new ConsoleSwitch <int, T>();

            cs.Load(collection, getString);
            return(cs.Choose());
        }
Beispiel #3
0
        public static string AskSwitch(string question, List <string> options)
        {
            var cs = new ConsoleSwitch <int, string>();

            for (int i = 0; i < options.Count; i++)
            {
                cs.Add(i, options[i]);
            }

            return(cs.Choose(question));
        }
        public static T ChooseConsole <T>(this IEnumerable <T> collection, Func <T, string> getString = null, string message = null) where T : class
        {
            if (message != null)
            {
                Console.WriteLine(message);
            }

            var cs = new ConsoleSwitch <int, T>();

            cs.Load(collection.ToList(), getString);
            return(cs.Choose());
        }