逐行读取.txt
using System;
using System.Collections.Generic;
using System.IO;
namespace ConsoleForPractice
{
class Program
{
static void Main(string[] args)
{
string path = @"E:\\";
StreamReader sr = new StreamReader(path+@"\0806\RunMachineList.txt");
List< string> machinelist =new List<string>();
string line;
while ((line = sr.ReadLine()) != null)
{
machinelist.Add(line);
}
foreach (string machine in machinelist)
Console.WriteLine(machine);
Console.ReadLine();
}
}
}