//Create dataFile.txt in LocalFolder and write “My text” to it
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFile sampleFile = await localFolder.CreateFileAsync("dataFile.txt");
await FileIO.WriteTextAsync(sampleFile, "My text");
//Read the first line of dataFile.txt in LocalFolder and store it in a String
StorageFile sampleFile = await localFolder.GetFileAsync("dataFile.txt");
String fileContent = await FileIO.ReadTextAsync(sampleFile);
2 回答
您可以使用
ApplicationData.Current.LocalSettings
作为字典,您可以在其中保存一些原始对象 .您可以在UWP中本地存储您的应用数据,例如
ApplicationData.Current.LocalFolder
,这是'Isolated storage'你在说什么 . 这是一个代码示例:您还可以在此处查看更多详细信息:Getting started storing app data locally