C# 从txt读取内容

  /// <summary>
        /// 从指定文件读取内容
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private string ReadTxt(string file)
        {
            FileStream fs = new FileStream(file,FileMode.Open,FileAccess.Read);
            StreamReader reader = new StreamReader(fs);
            string content =  reader.ReadToEnd();
            reader.Close();
            fs.Close();
            return content;


        }

 

posted @ 2013-01-21 20:16  louiskoo  阅读(344)  评论(0编辑  收藏  举报