VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-how-to-play-beep-sound-through-console/

⇱ C# | How to play Beep sound through Console - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | How to play Beep sound through Console

Last Updated : 29 Jan, 2019
Given a normal Console in C#, the task is to play Beep sound through the Console. Approach: This can be achieved with the help of Beep() method of Console Class in System package of C#. The Beep() method of Console Class is used to play a Beep sound through the Console speaker.
Syntax: public static void Beep (); Exceptions: This method throws HostProtectionException if this method was executed on a server, such as SQL Server, that does not permit access to a user interface.
Below programs show the use of Console.Beep() method: Program 1: Program 2: Play Beep sound n number of times.
Note: Please run the programs on offline Visual Studio to experience the output.
Comment
Article Tags:

Explore