C# iTuneslib COM only showing collection classes
After adding a reference to iTunes1.13typelibrary, and adding the
using ituneslib;
In the program, I created the itunesApp class, but in th开发者_如何转开发e iTunesLib namespace, there are no options for classes such as IITPlayList
or the track class, the only classes that show up are the collections. How do I access those classes?Answer from comment: you can declare objects of these types, they just don't show up in intellisense. an example of this is here:
foreach (IITPlaylist pl in iTunes.LibrarySource.Playlists)
{
foreach (IITTrack tr in pl.Tracks)
{
//do work
}
}
this code loops through each track in each playlist
It is not clear from your question what you gonna do with the iTunes SDK. Sample application you can get here
Note: C# in iTunes SDK is supported via COM Interop. There're no managed interfaces in iTunes SDK and you have to release objects yourself to avoid memory leaks. When you access some iTunes SDK objects it launches iTunes application. Collections doesn't support IEnumerable interface, so you can't use foreach statement. It is very slow in the collections enumeration.
精彩评论