StreamReader
有个ReadLine()方法StreamReader objReader = new StreamReader("aa.txt");
string sLine="";
ArrayList arrText = new ArrayList();
while (sLine != null)
{
sLine = objReader.ReadLine();
if (sLine != null)
arrText.Add(sLine);
}
objReader.Close();

解决方案 »

  1.   

    StreamReader sr = new StreamReader(path, System.Text.Encoding.UTF8);
                string allstr = sr.ReadToEnd();
                sr.Close();
                string[] strarr = allstr.Split(new string[] { "\r\n" }, StringSplitOptions.None);
      

  2.   

    StreamReader txtReader = new StreamReader(filepath); 
    int lcount = 0;
    while (txtReader.ReadLine()!= null) 

        lcount++;

    txtReader.Close();
    lcount//行数
      

  3.   

    其实.NET已经封装了这个方法的,可以直接调用:string[] lines = System.IO.File.ReadAllLines("C:\\aa.txt", Encoding.Default);可以了
      

  4.   

    LS的方法比我的简洁多了,不过其实过程应该都一样。
    不过ReadAllLines是吧我的那个过程封装了