How to play a sound in C#?
To play a sound file in C# we can useSoundPlayer
Class which has a built in method Play()
to start playing the sound. this class accept the sound file as parameter in the constructor.Example
public class Example
{
public static void Main()
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav");
player.Play();
}
}