读取txt文件的值
我的文件mail.txt
其值
1@126.com
2@sina.com
3@sohu.com
...
怎样将这些值存入arraylist?
------解决方案--------------------TextReader 有 ReadLine()
StreamReader re = File.OpenText("mmmmail.txt");
string input = null;
while ((input = re.ReadLine()) != null){
Console.WriteLine(input);
}
re.close;
------解决方案--------------------C# code
ArrayList al = new ArrayList();
using (StreamReader sr = new StreamReader(@"g:\mail.txt"))
{
while (sr.Peek() > -1)
al.Add(sr.ReadLine());
}