In the previous post I described how the playlists in an iTunes library are read from the XML file and then added to the listbox.
In order for the listbox to properly display these objects, the ToString() member for each of these playlist objects is called. Here’s this method:
public override string ToString() { return name() + " (ID: " + id() + ", " + getCount() + " titles)"; }
public string id() { return (string)((from element in _root.Descendants() where element.Value.Equals("Playlist ID") select element).First().NextNode as XElement); } public int getCount() { return (from element in _root.Descendants() where element.Value.Equals("Track ID") select element).Count(); }
No comments:
Post a Comment