StringBuilder: how to get the final String?

Mister Dev picture Mister Dev · Oct 23, 2008 · Viewed 59.8k times · Source

Someone told me that it's faster to concatenate strings with StringBuilder. I have changed my code but I do not see any Properties or Methods to get the final build string.

How can I get the string?

Answer

Patrick Desjardins picture Patrick Desjardins · Oct 23, 2008

You can use .ToString() to get the String from the StringBuilder.