Advertisement
Semper_Idem

Async Genertor

Dec 5th, 2020
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1.         static async IAsyncEnumerable<String> ReadLinesAsync(String filename)
  2.         {
  3.             using (var reader = File.OpenText(filename))
  4.             {
  5.                 String line;
  6.                 while ((line = await reader.ReadLineAsync()) != null)
  7.                 {
  8.                     yield return line;
  9.                 }
  10.             }
  11.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement