📅  最后修改于: 2022-03-11 14:48:51.384000             🧑  作者: Mango
public IEnumerable ReadLines(Func streamProvider,
Encoding encoding)
{
using (var stream = streamProvider())
using (var reader = new StreamReader(stream, encoding))
{
string line;
while ((line = reader.ReadLine()) != null)
{
yield return line;
}
}
}