[求助]这一句是什意思
sr.BaseStream.Seek(0, SeekOrigin.Begin);这一句是什意思,请仔细讲解
回复:(wsq1168)[求助]这一句是什意思
public void ReadFile()//文本{
FileStream fs = new FileStream("d:\\MyFile.txt", FileMode.Open, FileAccess.Read,FileShare.Read);
StreamReader sr = new StreamReader(fs);
sr.BaseStream.Seek(0, SeekOrigin.Begin);
string str = sr.ReadLine();
while (str != null)
{
Console.WriteLine(str);
str = sr.ReadLine();
}
sr.Close();
fs.Close();