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();
}
}
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.
精彩评论