コード例 #1
0
        private static void Main()
        {
            var message = new Message
            {
                Text = null !,
                From = null !
            };

            Console.WriteLine(message.Text);
            Console.WriteLine(message.From);

            MessagePopulator.Populate(message);
            Console.WriteLine(message.From !.Length); // ! : suppress nullable warning.
            Console.WriteLine(message.ToUpperFrom());

            Console.ReadLine();
        }
    }
コード例 #2
0
        public static void Part5_CS8NullDemos_Main()
        {
            Message message = new Message
            {
                Text = null !,
                From = null
            };

            MessagePopulator.Populate(message);

            Console.WriteLine(message.Text);
            Console.WriteLine(message.From);
            Console.WriteLine(message.From !.Length);
            Console.WriteLine(message.ToUpperFrom());

            Console.WriteLine("Press enter to end.");
            Console.ReadLine();
        }
    }