What is the best way (performance wise) to instantiate a new StringBuilder
from another one? (Copy-Ctor).
I don't want to pass via an immutable string as the underline data is very big.
so the below is valid, but not wanted.
StringBuilder newSB = new StringBuilder(oldSB.ToString());
I want something like
StringBuilder newSB = new StringBuilder(oldSB);
But this is not supported.
There’s an overload of Append
for other StringBuilder
instances:
var newSB = new StringBuilder(oldSB.Length);
newSB.Append(oldSB);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With