Is StringBuilder faster than String Concatenation?
Do you know when to use a StringBuilder as opposed to a string concatenation?
Most of the time, I've seen everyone using string concatenation (i.e. "The quick brown"+"fox") when creating their strings in C# or VB.NET. As a matter of fact, every interviewer I've talked to has asked me that same question:
If you were to concatenate a string, which would be faster? A StringBuilder class or just using the "+" to create your string?
Of course, I would say the StringBuilder class.
But one individual has taken it a step further and have proven that the StringBuilder is not always as fast as everyone says it is.
Chinh Do has a two-part post about how StringBuilder is not always faster and that string concatenation could provide a better performance...under certain circumstances.
The article is a must read for .NET developers who want to put the brakes on this programming myth.
Tools
Jonathan Danylko is a freelance web architect and avid programmer who has been programming for over 20 years. He has developed various systems in numerous industries including e-commerce, biotechnology, real estate, health, insurance, and utility companies.
When asked what he likes doing in his spare time, he answers..."programming."
Like this article?Subscribe for FREE to receive the latest posts before they become public.
Related Posts
- UPDATE: Multiple Project Area Support for ASP.NET MVC 2 RC
- MapAreaRoute Removed from ASP.NET MVC 2 RC
- Speed Links: ASP.NET MVC
- Microsoft Monday: August 17, 2009
- Microsoft .NET 4.0 Quick Links
0 Comments
No comments are posted.

RSS Links
Share

