我有以下代码:
List<Triple<string, Image, string>> videos= new VideosInfoGrapper().GrapInfo();
listView_Preview.SmallImageList = new ImageList();
foreach (Triple<string, Image, string> videoInfo in videos)
listView_Preview.SmallImageList.Images.Add((videoInfo.Image));
public struct Triple<T1, T2, T3>
{
public T1 VideTitle { set; get; }
public T2 Image { set; get; }
public T3 VideoUrl { set; get; }
public Triple(T1 t1, T2 t2, T3 t3)
: this()
{
this.VideTitle = t1;
this.Image = t2;
this.VideoUrl = t3;
}
}
视频对象中的所有图像都被正确获取,并且我在将图像添加到ImageList之前进行了调试,图像的值不为空,但是一旦图像被添加到列表中,它就变为空。