Stringbuilder - .Net
String object is immutable. Every time you use one of the methods in the System.String class it creates a new string object in memory, which requires a new allocation of space for the newly created string object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly.
allocated memory in some location say 4253
string str = "BlogHead";
erases contents at 4253 and creates new memory location say 8578
str += "geeks";
Any modifications you do to the string object memory will change.
No comments:
Post a Comment