private void WriteFormatHelper(string format, ParamsArray args, bool appendNewLine) { StringBuilder sb = StringBuilderCache.Acquire((format?.Length ?? 0) + args.Length * 8) .AppendFormatHelper(null, format !, args); // AppendFormatHelper will appropriately throw ArgumentNullException for a null format StringBuilder.ChunkEnumerator chunks = sb.GetChunks(); bool more = chunks.MoveNext(); while (more) { ReadOnlySpan <char> current = chunks.Current.Span; more = chunks.MoveNext(); // If final chunk, include the newline if needed WriteSpan(current, appendNewLine: more?false: appendNewLine); } StringBuilderCache.Release(sb); }
public RuneEnumerator(StringBuilder.ChunkEnumerator builderEnumerator) : this(CachedBuilderMoveNext) { _builderEnumerator = builderEnumerator; }