62,243
社区成员




//读取所有行
string[] sarr = File.ReadAllLines(@"c:\123.txt");
DataTable dt = new DataTable();
dt.Columns.Add("col1", typeof(string));
foreach (string s in sarr)
{
//添加到DataTable
dt.Rows.Add(s);
}
//读取所有行
string[] sarr = File.ReadAllLines(@"c:\123.txt");
foreach (string s in sarr)
{
//添加到DataTable
}
System.IO.TextReader tr = System.IO.File.OpenText("d:\\test123.txt");
System.Collections.ArrayList al = new ArrayList();
string tmp = tr.ReadLine();
while(tmp != null)
{
al.Add(tmp);
tmp = tr.ReadLine();
}
tr.Close();
string[] txts = new string[al.Count];
al.CopyTo(txts,0);