Пример #1
0
        private void buttonSayHello_Click(object sender, EventArgs e)
        {
            string name = this.textBoxName.Text;

            MessageBox.Show(string.IsNullOrEmpty(name)
                ? $"Please, enter your name at first."
                : HelloGenerator.GetHello(name));
        }
Пример #2
0
        public static void Main(string[] args)
        {
            var config = new ConfigurationBuilder()
                         .AddCommandLine(args)
                         .Build();

            string name = config["name"];

            if (string.IsNullOrEmpty(name))
            {
                Console.WriteLine("Write your name, please:");
                name = Console.ReadLine();
            }

            Console.WriteLine(HelloGenerator.GetHello(name));
            Console.ReadKey();
        }