adspace


What is difference between string and stringbuilder in c#?

Answer Posted / Ravi Bhushan Mishra

In C#, String and StringBuilder are both used for handling text data, but they have some key differences. A String is an immutable reference type, meaning once it's created, its value cannot be changed. On the other hand, StringBuilder is a mutable class that allows changing of string values after creation. StringBuilder provides better performance when dealing with large amounts of dynamic text because it reuses memory for changes instead of creating new objects.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is expression tree in c#?

1007


What is an abstract class c#?

978


Why can't we use a static class instead of singleton?

963


How do you inherit a class into other class in c#?

1001


How to assign Null value to Var?

1073


Which namespaces are necessary to create a localized application?

1151