none
Console.Write not working RRS feed

  • Question

  • I downloaded Visual Studio 2019 for Mac. I have the following C# code:

    using System;

    namespace Variables
    {
        class Program
        {
            static void Main(string[] args)
            {
                string myFirstName;
                Console.WriteLine("What is your name?");
                Console.Write("Type in your first name: ");
                myFirstName = Console.ReadLine();

                string myLastName;
                Console.Write("Type is your last name: ");
                myLastName = Console.ReadLine();

                Console.WriteLine("Hello, " + myFirstName + " " + myLastName);
                Console.ReadLine();      
            }
        }
    }


    However, when I run it on the Visual Studio Application Output, I only get "What is your name?". And that's it. It doesn't show the rest, I cannot see "Type in your fist name: ".

    Also, when I try executing it on an external console, the terminal doesn't execute the code at all!

    Does anyone know how I can get this to work?

    Thursday, May 23, 2019 5:11 AM

All replies

  • Hi Bryan.B.L,

    Welcome to MSDN forum.

    According to your description, it seems that the you should set the project option to be able to run in the external console.

    Please open the project options>> select Run>>Configuration>>Default, then check Run on external console.

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, May 24, 2019 5:21 AM