示例#1
0
        private static IEnumerable <int> ReadNumbers()
        {
            ValueList <int> luckyNumbersRead = new ValueList <int>("What are your lucky number?");

            luckyNumbersRead.Read();
            return(luckyNumbersRead.Values);
        }
示例#2
0
        private static IReadOnlyList <ConsoleColor> ReadColors()
        {
            ValueList <ConsoleColor> colorsRead = new ValueList <ConsoleColor>("What are your preferred colors?")
            {
                CustomParser = value => (ConsoleColor)Enum.Parse(typeof(ConsoleColor), value, true)
            };

            return(colorsRead.Read());
        }
示例#3
0
        /// <summary>
        /// By creating an instance of the <see cref="ListRead{T}"/>, additional properties can be set.
        /// </summary>
        private static List <string> ReadBeverages()
        {
            ValueList <string> beveragesRead = new ValueList <string>
            {
                Label = new TextBlock
                {
                    Text            = "What are your prefered beverages?",
                    ForegroundColor = ConsoleColor.Cyan
                },
                Bullet = "#"
                         // etc...
            };

            return(beveragesRead.Read());
        }