-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Now that IAsyncEnumerable<T> has landed, I'd like to propose the following new methods to the File type:
namespace System.IO {
public static partial class File {
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path, System.Text.Encoding encoding) { throw null; }
+ public static System.Collections.Generic.IAsyncEnumerable<string> ReadLinesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static System.Collections.Generic.IAsyncEnumerable<string> ReadLinesAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
}The methods would basically be async counterparts to File.ReadLines, so they would mirror what File.ReadAllLinesAsync does, i.e. use an asynchronous, sequential StreamReader, but read line by line lazily, without allocating a list or array.
These would fill the remaining gap for async reading done by the File type, as mentioned in https://github.com/dotnet/corefx/issues/11220.
Tyrrrz, reflectronic, henriksen, pkanavos, poke and 43 morenbarbettini, slang25 and eiriktsarpalis
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors