Đọc ()
Read () đọc các ký tự tiếp theo từ luồng đầu vào chuẩn. Nếu một phím được nhấn trên bảng điều khiển, thì phím đó sẽ đóng.
int a = Console.Read() Console.WriteLine(a);
ReadLine ()
Nó đọc dòng ký tự tiếp theo từ luồng đầu vào chuẩn.
Ví dụ
using System;
class Program {
static void Main() {
int x = 10;
Console.WriteLine(x);
Console.Write("\nPress any key to continue... ");
Console.ReadLine();
}
} Đầu ra
10 Press any key to continue...