我在以下代码中收到空引用错误:
string artistName = mov.get_Annotation((int)QTAnnotationsEnum.qtAnnotationArtist);
string albumName = mov.get_Annotation((int)QTAnnotationsEnum.qtAnnotationAlbum);
string songTitle = mov.get_Annotation((int)QTAnnotationsEnum.qtAnnotationFullName);
foreach (char c in artistName)
{
artistName = artistName.Replace("?", "");
artistName = artistName.Replace("*", "");
artistName = artistName.Replace("/", "");
artistName = artistName.Replace(":", "");
}
foreach (char c in albumName)
{
albumName = albumName.Replace("?", "");
albumName = albumName.Replace("*", "");
albumName = albumName.Replace("/", "");
albumName = albumName.Replace(":", "");
}
我已经从另一个人的项目中复制了这段代码,虽然我基本上明白发生了什么,但我无法弄清楚错误。错误出现在 for each (char c in artistName) 行上。谢谢你的帮助。