首页 > Windows开发 > 详细

C#读取txt文件

时间:2016-03-01 18:58:21      阅读:314      评论:0      收藏:0      [点我收藏+]

public List<string> ReadtxtInfo()
{
FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath("/") + @"/AllowList.txt", FileMode.Open);

StreamReader m_streamReader = new StreamReader(fs);
m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin);
List<string> Arrar1 = new List<string>();
string strLine = m_streamReader.ReadLine();
do
{
string[] split = strLine.Split(‘=‘);
string a = split[1];
Arrar1.Add(a);
strLine = m_streamReader.ReadLine();
} while (strLine != null && strLine != "");

m_streamReader.Close();
m_streamReader.Dispose();
fs.Close();
fs.Dispose();
return Arrar1;

}

C#读取txt文件

原文:http://www.cnblogs.com/zxk3113/p/5231958.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!