将文本文件显示到已经在应用程序中的文本块上
本文关键字:文本 应用程序 文件 显示 | 更新日期: 2023-09-27 18:18:27
我在一个应用程序中有一个文本文件。有人可以解释一下,算法上,我如何在文本块上显示文件的内容。
PS: I would be obliged if you didn't downvote this question as I'm banned from questioning further and trying to rectify my mistakes. Thank you, good sir.
这段代码从您的项目目录中加载文件,并以名称textBlock
显示在TextBlock
中
var rs = Application.GetResourceStream(new Uri("file.txt", UriKind.Relative));
StreamReader sr = new StreamReader(rs.Stream);
textBlock.Text = sr.ReadToEnd();
Where file.txt像Content一样保存在你的项目中