What is difference between string and stringbuilder in c#?



What is difference between string and stringbuilder in c#?..

Answer / 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

More C Sharp Interview Questions

What are the 2 broad classifications of fields in c#?

1 Answers  


Distinguish between continue and break statement?

1 Answers  


how to implement singelton in C# & its uses?

1 Answers   TCS,


What is the difference between const and readonly in c#.net?

1 Answers  


What?s class SortedList underneath?

1 Answers  


Can struct inherit from class c#?

1 Answers  


How do I develop c# apps?

1 Answers  


Is string a primitive data type in c#?

1 Answers  


What is data binding c#?

1 Answers  


What?s a satellite assembly?

2 Answers  


Why do we use parameters in c#?

1 Answers  


explain the three services model commonly know as a three-tier application.

1 Answers   Siebel Systems,


Categories