📌  相关文章
📜  c# 从文件流中读取所有行 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:51.384000             🧑  作者: Mango

代码示例1
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;
        }
    }
}