Avoid usage of `finally` in potentially hot path

This commit is contained in:
Dean Herbert 2022-07-06 19:55:43 +09:00
parent 01bc6e5cb7
commit c2f1069073
1 changed files with 4 additions and 8 deletions

View File

@ -34,14 +34,10 @@ public LineBufferedReader(Stream stream, bool leaveOpen = false)
/// </summary>
public string? ReadLine()
{
try
{
return peekedLine ?? streamReader.ReadLine();
}
finally
{
string? line = peekedLine ?? streamReader.ReadLine();
peekedLine = null;
}
return line;
}
/// <summary>