I have a list of words that I'd like to read into a list of strings. I'm having some trouble implementing this in a metro app with the Windows Runtime
Normally I'd use the follow code:
<!-- language: lang-vb -->'load text file in to word list
Using sr As New StreamReader(filePath)
Do While sr.Peek <> -1
WordList.Add(sr.ReadLine.Trim)
Loop
End Using
I'm trying to use the code from The right way to Read & Write Files in WinRT
<!-- language: lang-vb -->Dim folder = Windows.ApplicationModel.Package.Current.InstalledLocation
folder = folder.GetFolderAsync("Data")
Dim file = folder.GetFileAsync("WordList.txt")
Dim readFile = Windows.Storage.FileIO.ReadTextAsync(file)
But it gets tripped up on the second line and I wouldn't know what to do with it even if it didn't. I've killed the Await
keyword because for some reason it can't see the Async
attribute on the GetFolder
method.