How to Async Files.ReadAllLines and await for results?

前端 未结 5 911
滥情空心
滥情空心 2020-11-29 02:33

I have the following code,

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        button1.IsEnabled = false;

        var s = File.Re         


        
5条回答
  •  失恋的感觉
    2020-11-29 03:25

    I also encountered a problem described in your question. I've solved it just simplier that in previous answers:

    string[] values;
    StorageFolder folder = ApplicationData.Current.LocalFolder; // Put your location here.
    IList lines = await FileIO.ReadLinesAsync(await folder.GetFileAsync("Words.txt"););
    lines.CopyTo(values, 0);
    

提交回复
热议问题