I want to repeat .- 40 times and save it to a string using StringBuilder
Why does this not work?
string result = new StringBuilder("").Append(".-",0,40).ToString();
I know about other Solutions but i want to use StringBuilder
That method does not do what you think it does. The 2 int parameters specify the start index and length of the sub-string you want to append.
StringBuilder does have a method for what you want: It's called Insert:
sb.Insert(0, ".-", 40);
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