c# - IsolatedStorageFile.DeleteFile doesn't work -
c# - IsolatedStorageFile.DeleteFile doesn't work -
i seek that:
using (isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication()) { if (store.fileexists(filename)) { store.deletefile(filename); } }
but have system.io.isolatedstorage.isolatedstorageexception: unable delete file.
what wrong?
so resolve problem using filemode.truncate
on opening file.
using (isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication()) { using (var filestream = store.openfile(filename, filemode.truncate, fileaccess.readwrite, fileshare.readwrite)) { //do stuff } }
c# windows-phone-8 windows-phone
Comments
Post a Comment