قبلاً آموخته اید که Console.WriteLine() برای خروجی (چاپ) مقادیر استفاده می شود. اکنون از استفاده می کنیم برای دریافت ورودی کاربر.
Console.ReadLine()
در مثال زیر، کاربر میتواند نام کاربری خود را که در آن ذخیره میشود، وارد کند
متغیر use. سپس مقدار آن را چاپ می کنیم
ame:
use
ame
// Type your use
ame and press enter
Console.WriteLine("Enter use
ame:");
// Create a string variable and get user input from the keyboard and store it in the variable
string userName = Console.ReadLine();
// Print the value of the variable (userName), which will display the input value
Console.WriteLine("Use
ame is: " + userName);