public static void SkipBytes(this Stream stream, int byteCount) { var buffer = Buffer; while (byteCount > 0) { int toRead= (byteCount > buffer.Length) ? buffer.Length : byteCount; stream.Read(buffer, 0, toRead); byteCount -= toRead; } }