Example #1
0
        static void Main(string[] args)
        {
            PlayerCharacter?[] players =
            {
                new PlayerCharacter("Sarah"),
                new PlayerCharacter("Gentry"),
                null
            };


            PlayerDisplayer.Write(players[0]);
            PlayerDisplayer.Write(players[1]);
            PlayerDisplayer.Write(players[2]);
            PlayerDisplayer.Write(players[3]);

            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            PlayerCharacter?[] players =
            {
                new PlayerCharacter("Sarah"),
                new PlayerCharacter("Gentry"),
                new PlayerCharacter(null), // name will now have default value
                null
            };

            PlayerDisplayer.Write(players[0]);
            PlayerDisplayer.Write(players[1]);
            PlayerDisplayer.Write(players[2]);
            PlayerDisplayer.Write(players[3]);

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            PlayerCharacter[] players =
            {
                new PlayerCharacter {
                    Name = "Sarah"
                },
                new PlayerCharacter {
                    Name = "Gentry"
                },
                new PlayerCharacter {
                },                        // name will be null
            };


            PlayerDisplayer.Write(players[0]);
            PlayerDisplayer.Write(players[1]);
            PlayerDisplayer.Write(players[2]);

            Console.ReadLine();
        }