Skip to content

Commit

Permalink
Use Async I/O Method to have Async all the way down
Browse files Browse the repository at this point in the history
  • Loading branch information
bytefish committed Apr 20, 2019
1 parent bb2f01c commit a212c31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TinyCsvParser/TinyCsvParser.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TinyCsvParser", "TinyCsvPar
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TinyCsvParser.Test", "TinyCsvParser.Test\TinyCsvParser.Test.csproj", "{7093B73C-A1AB-42F0-BB04-353ED3444654}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyCsvParser.Benchmark", "TinyCsvParser.Benchmark\TinyCsvParser.Benchmark.csproj", "{39578C59-D34A-4CBD-AD1A-AD7921119C42}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TinyCsvParser.Benchmark", "TinyCsvParser.Benchmark\TinyCsvParser.Benchmark.csproj", "{39578C59-D34A-4CBD-AD1A-AD7921119C42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 3 additions & 3 deletions TinyCsvParser/TinyCsvParser/CsvParserExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ public static IAsyncEnumerable<CsvMappingResult<TEntity>> ReadFromStringAsync<TE

private static IAsyncEnumerable<string> ReadLinesFromStreamAsync(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks = false, int bufferSize = 1024, bool leaveOpen = false)
{
return ReadLinesFromStream(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen).ToAsyncEnumerable();
return ReadLinesFromStream(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen);
}

private static IEnumerable<string> ReadLinesFromStream(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks = false, int bufferSize = 1024, bool leaveOpen = false)
private static async IAsyncEnumerable<string> ReadLinesFromStream(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks = false, int bufferSize = 1024, bool leaveOpen = false)
{
using (var reader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen))
{
while (!reader.EndOfStream)
{
yield return reader.ReadLine();
yield return await reader.ReadLineAsync();
}
}
}
Expand Down

0 comments on commit a212c31

Please sign in to comment.