c# 4.0 - Writing files in windows phone 8 -
i want read , write data text file in windows phone 8 application. tried code
isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication(); streamwriter wr = new streamwriter(new isolatedstoragefilestream("file.txt", filemode.openorcreate, isf)); wr.writelineasync("hello"); wr.close();
but nothing. please me out of problem. thanks.
write data file:
isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication(); //create new file using (streamwriter writefile = new streamwriter(new isolatedstoragefilestream("myfile.txt", filemode.create, fileaccess.write, myisolatedstorage))) { string sometextdata = "this text data saved in new text file in isolatedstorage!"; writefile.writeline(sometextdata); writefile.close(); }
read data file:
isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication(); isolatedstoragefilestream filestream = myisolatedstorage.openfile("myfile.txt", filemode.open, fileaccess.read); using (streamreader reader = new streamreader(filestream)) { //visualize text data in textblock text this.text.text = reader.readline(); }
go through links: http://www.geekchamp.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files
Comments
Post a Comment