string[] fileNames = Directory.GetFiles(@".\\Log\\HiveData\\LogNoSendHive\\");
foreach (string fileName in fileNames)
{
//***** 方法 3 逐个文件逐行读取文本内容 *****//
string[] lines = File.ReadAllLines(fileName);
for (int i = 0; i < lines.Length; i++)
{
Debug.WriteLine(lines[i]);
}
//***** 方法 2 *****//
IEnumerable<string> line = File.ReadLines(fileName);
foreach (string fruit in line)
{
Debug.WriteLine(fruit);
}
//***** 方法 1 *****//
using (StreamReader reader = new StreamReader(fileName))
{
string lineax;
while ((lineax = reader.ReadLine()) != null)
{
Debug.WriteLine(line);
}
}
01-21
10-12
6820
07-27
377
03-03
3599
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交