public static string ReadRemainingContent(this IReadStringContent reader) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } var content = new StringBuilder(); while (reader.Current != null) { content.Append(reader.Current); reader = reader.GetNext(); } return(content.ToString()); }
private static IEnumerable <CharacterAndNextReader> Read(this IReadStringContent reader) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } while (true) { var currentCharacter = reader.Current; if (currentCharacter == null) { yield break; } var nextReader = reader.GetNext(); yield return(new CharacterAndNextReader(currentCharacter.Value, nextReader)); reader = nextReader; } }