C#逐行读取文件,对于大文件的读取非常有用
StreamReader sr = new StreamReader("fileName.txt");
string line;
while((line= sr.ReadLine()) != null) {
Console.WriteLine("xml template:"+line);
}
if (sr != null)sr.Close(); //should be in a "finally" or "using" block
C#逐行读取文件,对于大文件的读取非常有用
StreamReader sr = new StreamReader("fileName.txt");
string line;
while((line= sr.ReadLine()) != null) {
Console.WriteLine("xml template:"+line);
}
if (sr != null)sr.Close(); //should be in a "finally" or "using" block