C#学习教程:从独立存储中加载图像时出现内存不足异常publicBitmapImageGetImage(intpageNo){if(!this._isLoaded){this.Load();}使用(IsolatedStorageFileStreamstream=IsolatedStorageFile.GetUserStoreForApplication().OpenFile(this.FileNames[pageNo],FileMode.Open,FileAccess.Read)){BitmapImageimage=newBitmapImage();image.SetSource(流);返回图像;}}image.SetSource(stream)出现内存不足异常。我无法将uri设置为null,因为我必须返回图像。解决办法是什么?在这里帮助我,我有这个位图图像列表。私有列表_images=newList();当我离开页面时,uri被清除。以上就是《Insufficientmemoryexceptionwhenloadingimagesfromisolatedstorage》C#学习教程的全部内容。如果对大家有用,需要详细了解C#学习教程,希望大家多多关注——protectedoverridevoidOnNavigatedFrom(NavigationEventArgse){base.OnNavigatedFrom(e);这个.DataContext=null;foreach(varobjinthis._images){if(obj!=null){obj.ClearValue(BitmapImage.UriSourceProperty);}}本文收集自网络,不代表任何内容,如涉及侵权,请点击右边联系管理员删除。如需转载请注明出处:
