I am getting OutofMemoryException
in this particular code.
public BitmapImage GetImage(int pageNo)
{
if (!this._isLoaded)
{
this.Load();
}
using (IsolatedStorageFileStream stream = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(this.FileNames[pageNo], FileMode.Open, FileAccess.Read))
{
BitmapImage image = new BitmapImage();
image.SetSource(stream);
return image;
}
}
The out of memory exception is occuring at image.SetSource(stream)
. I cant set the uri to null
because I have to return the image.
What is the workaround for this? Help me here.
I had this list of bitmap images.
I cleared the uri while leaving the page.