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> /// </summary>
public string? ReadLine() public string? ReadLine()
{ {
try string? line = peekedLine ?? streamReader.ReadLine();
{
return peekedLine ?? streamReader.ReadLine(); peekedLine = null;
} return line;
finally
{
peekedLine = null;
}
} }
/// <summary> /// <summary>