1. 读取目录下的文件
string path=@"d:pinlog";
Files[] files= Directory.GetFiles(path,"*.txt");
Foreach(File file in files)
{
StreamReader reader=new StreamReader(file);
string headText=reader.ReadLine();//读取第一行
string bodyText=reader.ReadToEnd();
}
2. 获取更多的信息
DirectoryInfo folder=new DirectoryInfo(path);
Foreach(FileInfo fileInfo in folder.GetFiles(".txt"))
{
string fileName=fileInfo.FullName;
}