I Get the error message while write data in file --Cannot access the disposable object .Object name

Posted by kunal rai on Stack Overflow See other posts from Stack Overflow or by kunal rai
Published on 2010-05-20T05:28:53Z Indexed on 2010/05/20 5:30 UTC
Read the original article Hit count: 255

Filed under:
|

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();
        }
    }

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about c#