- System.String is immutable.(Non updatable)
- System.StringBuilder is mutable (Updatable)
- Using StringBuilder, various string operations can be performed in most effective manner.
class Program
{
static void Main(string[] args)
{
//for example:
string str = "hello"; //Creates a new object when we concatenate any other words along with str variable it does not actually modify the str variable, instead it creates a whole new string.
str = str + " to all";
Console.WriteLine(str);
StringBuilder s = new StringBuilder("Hi");
s.Append(" To All");
Console.WriteLine(s);
Console.Read();
}
}