我正在开发一个使用文件输入和输出的metro应用程序。我用来保存文件的代码是
StorageFolder appfolder = await Windows.Storage.KnownFolders.DocumentsLibrary.CreateFolderAsync("Appdata.abc", Windows.Storage.CreationCollisionOption.ReplaceExisting);
StorageFile file = await Windows.Storage.KnownFolders.DocumentsLibrary.CreateFileAsync(DateFileName + ".uvraj", Windows.Storage.CreationCollisionOption.ReplaceExisting);
现在如何在我创建的文件夹中创建/保存文件?
答案 0 :(得分:1)
调用appfolder
对象上的方法,而不是您正在使用的KnownFolder
。
像这样:
StorageFolder appfolder = await Windows.Storage.KnownFolders.DocumentsLibrary.CreateFolderAsync("Appdata.abc", Windows.Storage.CreationCollisionOption.ReplaceExisting);
StorageFile file = await appfolder.CreateFileAsync(DateFileName + ".uvraj", Windows.Storage.CreationCollisionOption.ReplaceExisting);