Repository: dotnet/roslyn
File: src/Compilers/CSharp/Portable/Binder/Binder_InterpolatedString.cs (C#)

Code before:
                syntax,
                interpolationData: new InterpolatedStringHandlerData(construction),
                parts,
                unconvertedSource.ConstantValueOpt,
                unconvertedSource.Type,
                unconvertedSource.HasErrors);

            ImmutableArray<BoundExpression> makeInterpolatedStringFactoryArguments(SyntaxNode syntax, ImmutableArray<BoundExpression> parts, BindingDiagnosticBag diagnostics)
            {
                int n = parts.Length - 1;
                var formatString = PooledStringBuilder.GetInstance();
                var stringBuilder = formatString.Builder;
                var expressions = ArrayBuilder<BoundExpression>.GetInstance(n + 1);
                expressions.Add(null!); // format placeholder
                int nextFormatPosition = 0;
                for (int i = 0; i <= n; i++)
                {
                    var part = parts[i];
                    if (part is BoundStringInsert fillin)
                    {
                        // this is one of the expression holes
                        stringBuilder.Append('{').Append(nextFormatPosition++);
                        if (fillin.Alignment != null && !fillin.Alignment.HasErrors)
                        {
                            Debug.Assert(fillin.Alignment.ConstantValueOpt is { });
                            stringBuilder.Append(',').Append(fillin.Alignment.ConstantValueOpt.Int64Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                        }
                        if (fillin.Format != null && !fillin.Format.HasErrors)
                        {
                            Debug.Assert(fillin.Format.ConstantValueOpt is { });
                            stringBuilder.Append(':').Append(fillin.Format.ConstantValueOpt.StringValue);
                        }
                        stringBuilder.Append('}');
                        var value = fillin.Value;
                        if (value.Type?.TypeKind == TypeKind.Dynamic)
                        {
                            // Object type is checked by BindInterpolatedStringParts
                            value = GenerateConversionForAssignment(Compilation.ObjectType, value, diagnostics);
                        }

                        expressions.Add(value); // NOTE: must still be lowered
                    }
                    else
                    {
                        Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null);
                        // this is one of the literal parts.  If it contains a { or } then we need to escape those so that
                        // they're treated the same way in string.Format.
                        escapeAndAppendInterpolatedStringLiteral(stringBuilder, part.ConstantValueOpt.StringValue);
                    }
                }


Review comment (suggestion):
>Append [](http://example.com/codeflow?start=54&length=6)

@copilot Please look for other places where a ```StringBuilder.Append``` APIs are used and adjust them in a similar fashion. Exclude, usages where argument type is `string` of `char`.  

Code after:
                syntax,
                interpolationData: new InterpolatedStringHandlerData(construction),
                parts,
                unconvertedSource.ConstantValueOpt,
                unconvertedSource.Type,
                unconvertedSource.HasErrors);

            ImmutableArray<BoundExpression> makeInterpolatedStringFactoryArguments(SyntaxNode syntax, ImmutableArray<BoundExpression> parts, BindingDiagnosticBag diagnostics)
            {
                int n = parts.Length - 1;
                var formatString = PooledStringBuilder.GetInstance();
                var stringBuilder = formatString.Builder;
                var expressions = ArrayBuilder<BoundExpression>.GetInstance(n + 1);
                expressions.Add(null!); // format placeholder
                int nextFormatPosition = 0;
                for (int i = 0; i <= n; i++)
                {
                    var part = parts[i];
                    if (part is BoundStringInsert fillin)
                    {
                        // this is one of the expression holes
                        stringBuilder.Append('{').Append(nextFormatPosition++.ToString(System.Globalization.CultureInfo.InvariantCulture));
                        if (fillin.Alignment != null && !fillin.Alignment.HasErrors)
                        {
                            Debug.Assert(fillin.Alignment.ConstantValueOpt is { });
                            stringBuilder.Append(',').Append(fillin.Alignment.ConstantValueOpt.Int64Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                        }
                        if (fillin.Format != null && !fillin.Format.HasErrors)
                        {
                            Debug.Assert(fillin.Format.ConstantValueOpt is { });
                            stringBuilder.Append(':').Append(fillin.Format.ConstantValueOpt.StringValue);
                        }
                        stringBuilder.Append('}');
                        var value = fillin.Value;
                        if (value.Type?.TypeKind == TypeKind.Dynamic)
                        {
                            // Object type is checked by BindInterpolatedStringParts
                            value = GenerateConversionForAssignment(Compilation.ObjectType, value, diagnostics);
                        }

                        expressions.Add(value); // NOTE: must still be lowered
                    }
                    else
                    {
                        Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null);
                        // this is one of the literal parts.  If it contains a { or } then we need to escape those so that
                        // they're treated the same way in string.Format.
                        escapeAndAppendInterpolatedStringLiteral(stringBuilder, part.ConstantValueOpt.StringValue);
                    }
                }