我有一个问题,这是否可能。我想使用for循环来生成位图,对该位图执行某些操作,然后将其存储在List<Bitmap>
中。C#位图列表Flushing
我知道位图可能会占用大量内存,因此我在考虑将位图添加到列表后考虑处理位图。这里是我的代码:
List<Bitmap> listOfBitMaps = new List<Bitmap>();
foreach (string thingImLooping in ThingImLoopingThrough)
{
Bitmap bmp = new Bitmap(1250, 1250);
// do stuff to bitmap
listofBitMaps.Add(bmp);
bmp.Dispose();
}
此代码后,我有过每个位循环并打印的代码,但位图不在列表中?
在这种情况下,我怎么能不成为记忆猪?
谢谢!