Core C#

Simple Input

This C# program demonstrates how to wait for input from the user via console window. Note that each ReadLine() command pauses the execution until the Enter key is pressed. Notice that in order to print quotation marks, they need to be preceded by a slash.

Program.cs

using System;

namespace XoaX {
    class Program {
        static void Main(string[] args) {
            Console.WriteLine("And God said, \"Let there be light\"; and there was light.");
            Console.Write("Press \"Enter\"");
            Console.ReadLine();
            Console.WriteLine("And God said, \"Let there be a firmament ...\"");
            Console.Write("Press \"Enter\"");
            Console.ReadLine();
            Console.WriteLine("And God said, \"Let the waters under the heavens be gathered ...\"");
        }
    }
}
 

Output

And God said, "Let there be light"; and there was light.
Press "Enter"
And God said, "Let there be a firmament ..."
Press "Enter"
And God said, "Let the waters under the heavens be gathered ..."
Press any key to continue . . .
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.