
silverlight 如何保存文件
如何将文本“HelloWorld”保存为myText.txt文件我使用了如下代码,IsolatedStorageFileisf=IsolatedStorageFile.G...
如何将文本“Hello World” 保存为myText.txt文件
我使用了如下代码,
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
Stream stream = new IsolatedStorageFileStream("MyText.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write, isf);
System.IO.TextWriter writer = new System.IO.StreamWriter(stream);
writer.Write("Hello World");
writer.Close(); // Close the writer so data is flushed
stream.Close();
可是无法保存成功,磁盘上没有这个文件。 展开
我使用了如下代码,
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
Stream stream = new IsolatedStorageFileStream("MyText.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write, isf);
System.IO.TextWriter writer = new System.IO.StreamWriter(stream);
writer.Write("Hello World");
writer.Close(); // Close the writer so data is flushed
stream.Close();
可是无法保存成功,磁盘上没有这个文件。 展开
1个回答
展开全部
Stream stream = isf.CreateFile("MyText.txt");
...
writer.Flush();
writer.Close();
stream.Close();
试试看
btw我忘记是Create还是CreateFile了。。
...
writer.Flush();
writer.Close();
stream.Close();
试试看
btw我忘记是Create还是CreateFile了。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询