-
-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Description
Sometimes you may want to skip the lines in a file when reading from it with a StreamReader so having a SkipLines() method would be super helpful.
public static class StreamReaderExtensions
{
/// <summary>
/// Skips the specified number of lines in a stream reader based on its current position.
/// </summary>
/// <param name="streamReader">The stream reader.</param>
/// <param name="skipCount">The number of lines to skip.</param>
private static void SkipLines(this StreamReader streamReader, int skipCount)
{
for (var i = 0; i < skipCount && !streamReader.EndOfStream; i++)
{
streamReader.ReadLine();
}
}
}
Metadata
Metadata
Assignees
Labels
No labels