Because mySoundFile
is a Stream
, you can take advantage of SoundPlayer
's overloaded constructor, which accepts a Stream
object:
System.IO.Stream str = Properties.Resources.mySoundFile;
System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str);
snd.Play();
SoundPlayer Class Documentation (MSDN)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…