处理 BitmapImage [英] Dispose of a BitmapImage
问题描述
我有一个使用多个 BitmapImage
的 Windows 通用应用程序.我习惯于在 using
s 或使用 Dispose
中包装 Bitmap
s(在 Winforms 中),但我发现 BitmapImage
没有 Dispose
方法.有没有办法在等待 GC 之前释放他们的资源?
I have a Windows Universal App which uses several BitmapImage
s. I'm used to wrapping Bitmap
s (in Winforms) in using
s or using Dispose
, but I've discovered that BitmapImage
doesn't have a Dispose
method. Is there any way to release their resources earlier than waiting for the GC to do that?
推荐答案
这里有一个很好的解决方案:Windows Phone 8 中 BitmapImage/Image 控件的内存消耗 .它就像 BitmapImage
Here's a good solution : Memory consumption of BitmapImage/Image control in Windows Phone 8 . it's like a extension 'Dispose
' method for the BitmapImage
是的,GC.Collect() 是个好方法..
And yes, GC.Collect() is good way ..
这篇关于处理 BitmapImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!