Is StringBuilder faster than String Concatenation?
Monday, October 01, 2007 11:30 AM
Posted by Jonathan Danylko | Tag: .NET | Comments: 0 | View blog reactions
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.
Technorati Tags: Design/Develop, .NET, StringBuilder, ASP.NET
Related Articles:
- The Return of DCS Media
- How to build your own AJAX RSS Reader
- ASP.NET AJAX Client Life-Cycle Events
- Speed Links - Jul-30-2007: .NET
Chatterbox - 0 Comments
Posting anonymous comments requires approval
and will not appear immediately.
Please Register or Login to post a comment.

RSS
DCS-Media provides reviews, techniques, technologies, programming and design tips to help you conduct not just business, but smart business.

Digg This
del.icio.us
Ma.gnolia
Reddit