This is how I read info from a file:
var storageFolder = ApplicationData.Current.LocalFolder; var file = await storageFolder.GetFileAsync("test.txt"); var text = await FileIO.ReadTextAsync(file); How to check its availability?
This is how I read info from a file:
var storageFolder = ApplicationData.Current.LocalFolder; var file = await storageFolder.GetFileAsync("test.txt"); var text = await FileIO.ReadTextAsync(file); How to check its availability?
is this one better?
File.Exists (String) It turned out to check on the advice of @Grundy using TryGetItemAsync. The code itself is:
var storageFolder = ApplicationData.Current.LocalFolder; if (await storageFolder.TryGetItemAsync("test.txt") != null) { var file = await storageFolder.GetFileAsync("test.txt"); var text = await FileIO.ReadTextAsync(file); if (text != "") { //Некоторый код } } Source: https://ru.stackoverflow.com/questions/585034/
All Articles