public void LibraryTracks() { Controller controller = new Controller(); TrackCollection tracks = controller.LibraryPlaylist.Tracks; PersistentIDCollection pids = new PersistentIDCollection(); //List<int> tids = new List<int>(); watch.Start(); foreach (Track track in tracks.Values) { if (track != null) { pids.Add(track.PersistentID); //tids.Add(track.trackID); track.Dispose(); } } watch.Stop(); Console.WriteLine(String.Format("Found {0} tracks", pids.Count)); Console.WriteLine(String.Format("Completed in {0} ms", watch.GetElapsedMilliseconds())); tracks.Dispose(); tracks = null; controller.Dispose(); controller = null; }