public static async Task <List <string> > ReadLinesAsync(string filePath, Encoding defaultEncoding) { using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath)) using (var reader = new StaticEncodingLineReader(stream, defaultEncoding)) { return(await reader.ReadLinesAsync().ConfigureAwait(false)); } }
public static async Task <IEnumerable <string> > ReadLinesAsync(string filePath, Encoding encoding) { if (filePath == null) { throw new ArgumentNullException(nameof(filePath)); } using (var stream = FileStreamEx.OpenAsyncReadFileStream(filePath)) using (var reader = new StaticEncodingLineReader(stream, encoding)) { return(await reader.ReadLinesAsync().ConfigureAwait(false)); } }