string and string builder class
-
Sir/Madam, Please explain the basic difference between string and string builder class.I know one difference is , string builder variable is gets the dynamic memory and string class not. Thanks.
String builder variable is preferred over string variable, when there is a need to store a larger string and also when you need to create any string value by appending to the same variable. In such a case, when we consider a string variable, when we reassign any value to a string variable, it allocates NEW memory location along with the new char whatever we appended. hence every time we reassign to a string variable, memory allocations increase and thus affects the performace, where as in case of string builder this is not the case and hence preferred.
Renu.K