What are the differences between System.String and System.Text.StringBuilder classes?

DWQA QuestionsCategory: C SharpWhat are the differences between System.String and System.Text.StringBuilder classes?
Editor Staff asked 3 months ago

What are the differences between System.String and System.Text.StringBuilder classes?

1 Answers
Editor Staff answered 3 months ago

System.String is immutable. When we modify the value of a string variable, then a new memory is allocated to the new value and the previous memory allocation released. System.StringBuilder was designed to have a concept of a mutable string where a variety of operations can be performed without allocating separate memory locations for the modified string.