VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/console-keyavailable-property-in-c-sharp/

⇱ Console.KeyAvailable() Property in C# - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Console.KeyAvailable() Property in C#

Last Updated : 11 Jul, 2025

Console.KeyAvailable Property is used to get a value which shows whether a key press is available in the input stream. This property does not block input until a key press is available.

Syntax: public static bool KeyAvailable { get; } 
Property Value: It will return true if a key press is available otherwise, it returns false. 
 

Exceptions: 

  • InvalidOperationException: If the standard input is redirected to a file instead of the keyboard.
  • IOException: If an I/O error occurred.

Example:  

Output: 

👁 Image


Reference: 


 

Comment

Explore