Skip to content

Commit

Permalink
Remove unnecessary StreamReader.EndOfStream call from NetworkInformat…
Browse files Browse the repository at this point in the history
…ion (dotnet#109631)

* Remove unnecessary StreamReader.EndOfStream call from NetworkInformation

* Update src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Statistics.cs

Co-authored-by: Theodore Tsirpanis <[email protected]>

---------

Co-authored-by: Theodore Tsirpanis <[email protected]>
  • Loading branch information
stephentoub and teo-tsirpanis authored Nov 9, 2024
1 parent 19cd424 commit d820873
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,8 @@ internal static IPInterfaceStatisticsTable ParseInterfaceStatisticsTableFromFile
sr.ReadLine();
sr.ReadLine();
Span<Range> pieces = stackalloc Range[18]; // [0]-[16] used, +1 to ensure any additional segment goes into [17]
while (!sr.EndOfStream)
while (sr.ReadLine() is string line)
{
string line = sr.ReadLine()!;
if (line.Contains(name))
{
ReadOnlySpan<char> lineSpan = line;
Expand Down

0 comments on commit d820873

Please sign in to comment.