Example #1
0
        public static T[]? ChooseConsoleMultiple <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.ChooseMultiple());
        }
Example #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());
        }
        public static T[] ChooseConsoleMultiple <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.ChooseMultiple());
        }
Example #4
0
        public static T ChooseConsoleWithFilter <T>(this IEnumerable <T> collection, Func <T, bool> predicate, 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.Where(predicate).ToList(), getString);
            return(cs.Choose());
        }