How can I play a sound in WinForms?

audio, c#, winforms

Solution

For playing sound simply, with no interaction you can use System.Media.SoundPlayer:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = "soundFile.wav";
player.Play();

Problem

How can I play a sound in WinForms with C#?

Original source

Related problems