A string that we can change is called a StringBuilder. In this case, if we create any string object then we can perform any operation like insert, replace, etc. without creating a new instance for every time. It will update string at one place in memory doesn't create new space in memory.
Code:-
using System;
using System.Text;
class GFG {
public static void Main(String[] args)
{
String str = "OM ";
StringBuilder sbl = new StringBuilder(str);
sbl.Append("JI MISHRA");
Console.WriteLine(sbl);
}
}
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
A string that we can change is called a StringBuilder. In this case, if we create any string object then we can perform any operation like insert, replace, etc. without creating a new instance for every time. It will update string at one place in memory doesn't create new space in memory.
Code:-