Read text file in project folder in Windows Phone 8.1 Runtime

后端 未结 3 1079
[愿得一人]
[愿得一人] 2020-12-03 11:01

I want read one file .txt in root folder of my project into my database at first time application launch, but I don\'t know how to do that. Anyone know how can I do that, pl

3条回答
  •  孤街浪徒
    2020-12-03 11:47

    A slightly different way to access the file:

    var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
    var file = await folder.GetFileAsync("sample.txt");
    var contents = await Windows.Storage.FileIO.ReadTextAsync(file);
    

提交回复
热议问题