Console.ReadKey()
"Get a character or function key pressed by the user", ReadKey()
the function has no parameters , and the pressed key is displayed in the console window.
Console.ReadKey(true)
ReadKey()
functionaloverload, ReadKey(bool intercept)
the function has a parameter , which determines whether to display the pressed key in the console windowtrue
, means not to display the pressed key, and false
means to display the pressed key
Summarize:
Obviously, when the parameter false
is , the function is the same as without the parameter, so when we use ReadKey, there Console.ReadKey()
are Console.ReadKey(true)
two common situations, in which the former displays a character obtained, and the latter does not.