Play mp3 or wmv audio files in .net

You can play system sound in .net with the help of SystemSound class. And you can also play wav audio file from the .net application by using SoundPlayer class.
But when you need to play mp3 or wmv audio files, you will find that there is no any method to play those formats. The easiest way to go is to let the shell do it for you: see this

Example

The following example demonstrates how to play the audio file in C# and vb.net.

[vb.net]

    Private Sub playAudio()
        Dim path As String = "path to the audio file"
        Dim info As ProcessStar Info = New ProcessStartInfo(path)
        info.UseShellExecute = True
        Process.Start(info)
    End Sub

[C#]

   private void PlayAudio()
        {
            string path = "path to the audio file";
            System.Diagnostics.ProcessStartInfo info =
                new System.Diagnostics.ProcessStartInfo() { FileName = path, UseShellExecute = true };
            System.Diagnostics.Process.Start(info); 
        }

Simple we are using System.Diagnostics.ProcessStartInfo inheritable class and process class to play the file.
From the above we set UseShellExecute property to true to use the shell when starting the process; otherwise, the process is created directly from the executable file. The default is true.