Thursday, August 16, 2012

C# difference between StringBuilder and String Object

The most common operation with string is concatenation, and this has to be performed very efficiently.
When we use String objects to concatenate two strings , then a new copy of string object is created in memory by adding two objects , and the old string object is deleted.

So we use StringBuilder to do it in a effective way, here the concatenation is done on the exsisting  string, hence the insertion is faster. Concatenation is done using Append() method

No comments:

Post a Comment