aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Extensions/StreamExtensions.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-01-08 23:57:27 +0100
committerBond_009 <bond.009@outlook.com>2021-05-06 14:12:43 +0200
commitddb04dc12b8bdf33c2020cb1c539664463e61bc3 (patch)
tree85df78a91653216062cdd9cf52963baa141242fb /MediaBrowser.Common/Extensions/StreamExtensions.cs
parent95b1cf532b577aa744d5301af4eeb78d08da3ba8 (diff)
Use new ReadAllLines extensions
Diffstat (limited to 'MediaBrowser.Common/Extensions/StreamExtensions.cs')
-rw-r--r--MediaBrowser.Common/Extensions/StreamExtensions.cs20
1 files changed, 17 insertions, 3 deletions
diff --git a/MediaBrowser.Common/Extensions/StreamExtensions.cs b/MediaBrowser.Common/Extensions/StreamExtensions.cs
index cd77be7b2..d49bf1d46 100644
--- a/MediaBrowser.Common/Extensions/StreamExtensions.cs
+++ b/MediaBrowser.Common/Extensions/StreamExtensions.cs
@@ -35,11 +35,11 @@ namespace MediaBrowser.Common.Extensions
}
/// <summary>
- /// Reads all lines in the <see cref="StreamReader" />.
+ /// Reads all lines in the <see cref="TextReader" />.
/// </summary>
- /// <param name="reader">The <see cref="StreamReader" /> to read from.</param>
+ /// <param name="reader">The <see cref="TextReader" /> to read from.</param>
/// <returns>All lines in the stream.</returns>
- public static IEnumerable<string> ReadAllLines(this StreamReader reader)
+ public static IEnumerable<string> ReadAllLines(this TextReader reader)
{
string? line;
while ((line = reader.ReadLine()) != null)
@@ -47,5 +47,19 @@ namespace MediaBrowser.Common.Extensions
yield return line;
}
}
+
+ /// <summary>
+ /// Reads all lines in the <see cref="TextReader" />.
+ /// </summary>
+ /// <param name="reader">The <see cref="TextReader" /> to read from.</param>
+ /// <returns>All lines in the stream.</returns>
+ public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
+ {
+ string? line;
+ while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null)
+ {
+ yield return line;
+ }
+ }
}
}