tags:

views:

29

answers:

1

This was the code:

 public static void SaveFile(Stream stream, string fileName = "")
    {
        using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
        {
            IsolatedStorageFileStream fs = file.CreateFile(fileName);

            var filesize = stream.Length;
            var getContent = new byte[(int)filesize];
            stream.Read(getContent, 0, (int)filesize);
            fs.Write(getContent, 0, (int)filesize);

            fs.Close();
        }
    }
A: 

There isn't anything wrong with the code you've posted. The fault is in the code you are using to call this function. Most likely you are passing a Stream which has been disposed prematurely.

AnthonyWJones