To read input from the console window in C#, we can make use of the Console.ReadLine()
method. Here is an example usage:
main.cs214 chars9 lines
In the above example, we first prompt the user for input by using Console.Write()
to display the string "Enter your name: " on the screen. We then use Console.ReadLine()
to wait for user input, and store the input in the name
variable. Finally, we print a message to the console window using Console.WriteLine()
, which includes the user's input.
gistlibby LogSnag