what happens to existing memory of string , if new string is created every time when concatenating [Resolved]

Posted by Kasani007 under C# on 1/10/2017 | Points: 10 | Views : 1628 | Status : [Member] | Replies : 1
what happens to existing memory of string , if new string is created every time when concatenating string ?




Responses

Posted by: Sheonarayan on: 1/10/2017 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
It remains in the memory of the system till Garbage collector collects (dispose) it. So concatenating string basically increase the consumption of RAM of your system that degrades the overall performance of the system.

It is suggested to use StringBuilder, read this http://www.dotnetfunda.com/articles/show/1011/aspnet-stringbuilder-and-datatable.

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response