What’s the difference between System.String and
System.Text.StringBuilder classes with example

Answer Posted / puneet mishra

according to me difference between a string class and using String Builder is that in using a string class you need to create new object befour appending it to the main string but in string builder class one don`t need to create object every time

Example for string builder class:
using System.Text;

stringBuilder str = new stringBuilder;
str.append("");

in the previous example once u create str as new instance of string builder class u just have to append every thing in to the string

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c# in asp net?

480


Why is aws serverless?

497


I want to print "Hello" even before main() is executed. How will you achieve that?

508


what is inheritance and an example in vb.net and c# of when you might use it?

525


What is typeof undefined?

502






How to update the gui from another thread in c#?

550


What is sealed class in c#?

517


What are collection classes?

464


How do I declare a pure virtual function in c#?

584


Which namespaces are necessary to create a localized application?

606


What is difference between for and foreach in c#?

462


Can you change the value of a constant filed after its declaration?

517


What is string programming language?

431


What is multithreading? What are the problems that comes with multithreading and how to manage them?

546


What is the namespace for datatable in c#?

490