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?

  • GetFileAttributes () can be used. - Vladimir Martyanov
  • 2
    can look towards TryGetItemAsync - Grundy
  • @Grundy Thank you, your option came up more) - Denisok
  • @Denisok, then add the answer with an example and explanation - Grundy 2:46 pm

2 answers 2

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 != "") { //Некоторый код } }