Read()从标准输入流中读取下一个字符。如果在控制台上按下某个键,则它将关闭。
int az = Console.Read() Console.WriteLine(z);
它仅从标准输入流中读取单个字符。
从标准输入流中读取下一行字符。
using System;
class Program {
static void Main() {
int x = 10;
Console.WriteLine(x);
Console.Write("\nPress any key to continue... ");
Console.ReadLine();
}
}输出结果
10 Press any key to continue...