Language
Version: 5
Categories
-
User Program Communication
-
Variables
-
Control Flow
-
Object Oriented Programming
-
Strings
User Program Communication
User Input in C#
Used to read text from the user.
Syntax
string storeVariable = Console.ReadLine();
Notes
The ReadLine method, by default, stores the result in string format.
Example
Console.WriteLine("What is your full name?");
string name = Console.ReadLine();
Console.WriteLine("Your name is " + name); ///Output is 'Your name is (contents of name)'