StringBuilder() constructor is used to initialize a new instance of the StringBuilder class which will be empty and will have the default initial capacity. StringBuilder is used to represent a mutable string of characters. Mutable means the string which can be changed. So String objects are immutable but StringBuilder is the mutable string type. It will not create a new modified instance of the current string object but do the modifications in the existing string object.
public StringBuilder ();
Here 16 is the default capacity.
- Using this constructor will set the string value of the current instance to String.Empty.
- Capacity is set to the implementation-specific default capacity. Here it is 16.
- StringBuilder in C#
- C# | String vs StringBuilder
- StringBuilder.EnsureCapacity() Method in C#
- How to find the MaxCapacity of a StringBuilder in C#
- How to remove all characters from StringBuilder in C#
- StringBuilder.CopyTo Method in C#
- StringBuilder.ToString Method in C#
- C# | Creating StringBuilder having specified capacity
- StringBuilder.Chars Property in C#
- How to find the length of the StringBuilder in C#
- How to find the Capacity of a StringBuilder in C#
- C# | Check if two StringBuilder objects are Equal
- How to create an OrderedDictionary in C#
- How to create a ListDictionary in C#
- How to create a StringCollection in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.