将StorageFile端到端读入字符串的最简单方法是什么?

时间:2016-06-24 20:47:32

标签: javascript c# file windows-10-universal storagefile

我有一个foreach(Wall wall in WallsList) { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("Name: {0}", wall.Name)); sb.AppendLine(string.Format("Width: {0}", wall.Width.ToString())); sb.AppendLine(string.Format("Length: {0}", wall.Length.ToString())); Debug.WriteLine(sb.ToString()); } 对象,我正在尝试读取一个字符串(用于调试目的)。最简单的方法是什么?

1 个答案:

答案 0 :(得分:1)

在C#中:

string text = await Windows.Storage.FileIO.ReadTextAsync(storageFile);

在JavaScript中:

var text = Windows.Storage.FileIO.readTextAsync(storageFile).then(file => do_stuff(file))