Help writing program in C# RRS feed

  • Question

  • How do I ask for a user to input their name and address and have the program return what they say? I also have to store the name and address into a text file. 
    Thursday, September 13, 2018 5:25 PM

All replies

  • Hi kaypro94,

    Thank you for posting here.

    Here is a simple example for your reference.

      List<string> lines = new List<string>();
                Console.WriteLine("Please input your name:");
                string name = Console.ReadLine();
                Console.WriteLine("Please input your address");
                string address = Console.ReadLine();
                Console.WriteLine("Thanks! Save it.");
                File.WriteAllLines("file.txt", lines);

    Best Regards,


    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

    • Proposed as answer by Vivek Bansod Friday, September 14, 2018 10:20 AM
    Friday, September 14, 2018 7:30 AM