private void completedPlaylist(string playlist, string type) { string key = ""; foreach (KeyValuePair <string, SoundPlaylist> pl in playlists) { if (pl.Value.samplename == playlist) { key = pl.Key; } } if (key != "") { SoundPlaylist cp = playlists[playlist]; cp.callback(playlist, "complete"); playlists.Remove(key); cp.dispose(); } }