Exemplo n.º 1
0
        public static bool TryParse(string s, out Card?result)
        {
            var suit = s.Last();
            var rank = new string(s.Take(s.Length - 1).ToArray());

            if (CardService.Suits().Contains(suit) && CardService.Ranks().Contains <string>(rank))
            {
                result = new Card(rank, suit);
                return(true);
            }

            result = null;
            return(false);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CardService card = new CardService();

            Console.WriteLine("Part 1:");
            card.Part1();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Part 2:");
            card.Part2();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Part 3:");
            card.Part3();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Part 4:");
            card.Part4();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Part 6:");
            card.Part6();
            Console.WriteLine("-----------------------");
        }