.NET读取服务器或本地文件

       //把本地文件信息读入数据流中
                    FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    StreamReader reader = new StreamReader(stream);
                    StringBuilder sb = new StringBuilder();
                    do
                    {
                        sb.AppendLine(reader.ReadLine());
                    } while (!reader.EndOfStream);

       return sb.ToString();

posted @ 2017-04-14 15:25  (john_zhang)  阅读(1253)  评论(0编辑  收藏  举报