dotnet / dotnet/vblang

Extend string concatenation operator (&) to support StringBuilder as its left operand

Open
#114 7 comments 5 reactions 0 assignees View on GitHub
Proposal
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Concatenation is fine for simple cases but we've all had it drilled into us that StringBuilder is the way to go for successively building up large strings, particularly in loops, to avoid creating lots of very large garbage. The problem is that you have to completely change your code to go from one to the other. But, if we extend & to support StringBuilder on the left then most of the code could stay the same using `&=` and only the declaration of the variable would need to change to reap performance improvements.

In short, `StringBuilder & ` would be defined to be `StringBuilder.Append()` and `StringBuilder &= ` would be defined as `StringBuilder = StringBuilder.Append()`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.