处理 BitmapImage [英] Dispose of a BitmapImage

查看:19
本文介绍了处理 BitmapImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用多个 BitmapImage 的 Windows 通用应用程序.我习惯于在 usings 或使用 Dispose 中包装 Bitmaps(在 Winforms 中),但我发现 BitmapImage 没有 Dispose 方法.有没有办法在等待 GC 之前释放他们的资源?

I have a Windows Universal App which uses several BitmapImages. I'm used to wrapping Bitmaps (in Winforms) in usings 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆