且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Windows Phone 从文本文件中读取

更新时间:2023-02-20 10:51:49

这是从 wp7 应用程序中的解决方案读取文本文件的解决方案.

Here is the solution to read a text file from solution in wp7 app.

  1. 复制解决方案中的文本文件.

  1. Copy text file in your solution.

右键单击 -> 属性

现在将构建操作设置为资源.

Now set Build Action to Resource.

System.IO.Stream src = Application.GetResourceStream(new Uri("solutionname;component/text file name", UriKind.Relative)).Stream;
            using (StreamReader sr = new StreamReader(src))
              {
                 string text = sr.ReadToEnd();
              }