C# | How to play Beep sound through Console
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 2: Play Beep sound n number of times.
Note: Please run the programs on offline Visual Studio to experience the output.