ReadLine() 方法不接受字符串,程序在不读取字符串的情况下执行,如输出所示。
using System;
namespace ReadReadLineMethod
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
//using read method
Console.WriteLine("Write a character: ");
char a=(char)Console.Read();
Console.WriteLine(a);
//using readline method
Console.WriteLine("Enter a line: ");
string s=Console.ReadLine();
Console.WriteLine(s);
}
}
}