Windows Phone 读取文本文件

来源:互联网 发布:ssh酒店管理系统源码 编辑:程序博客网 时间:2024/06/06 03:16

 应用程序中读取工程目录下的txt文本文件方法,将TXT添加到资源,设置属性为content,读取方法为:

   string fileName = "123.txt";

            StreamResourceInfo resourceInfo = Application.GetResourceStream(newUri(fileName, UriKind.Relative));
            using (StreamReader reader = new StreamReader(resourceInfo.Stream))
            {
                    writingTextBlock.Text = reader.ReadToEnd();
                    reader.Close();
              }
            }

        }