你应该如何处理 BitmapSource 的释放?
// this wont work because BitmapSource doesnt implement IDisposable
using(BitmapSource bitmap = new BitmapImage(new Uri("myimage.png")))
{
}
你应该如何处理 BitmapSource 的释放?
// this wont work because BitmapSource doesnt implement IDisposable
using(BitmapSource bitmap = new BitmapImage(new Uri("myimage.png")))
{
}
您不需要Dispose()一个BitmapSource。 与框架中的其他“图像”类不同,它不包装任何本机资源。
只需让它超出范围,垃圾收集器将释放其内存。