StringBuilder.ToString Method in C# Last Updated : 29 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report This method is used to converts the value of this instance to a String. A new String object is created and initialized to get the character sequence from this StringBuilder object and then String is returned by ToString(). Subsequent changes to this sequence contained by Object do not affect the contents of the String. Syntax: public override string ToString (); Return Value: This method returns the String representing the data contained by StringBuilder Object. Below programs illustrate the StringBuilder.ToString() method: Example 1: csharp // C# program to demonstrate // the ToString() Method using System; using System.Text; class GFG { // Main Method public static void Main(String[] args) { // create a StringBuilder object // with a String pass as parameter StringBuilder str = new StringBuilder("GeeksForGeeks"); // print string Console.WriteLine("String contains = " + str.ToString()); } } Output: String contains = GeeksForGeeks Example 2: csharp // C# program to demonstrate // the ToString() Method using System; using System.Text; class GFG { // Main Method public static void Main(String[] args) { // create a StringBuilder object // with a String pass as parameter StringBuilder str = new StringBuilder("GeeksforGeeks Contribute"); // print string Console.WriteLine("String contains = " + str.ToString()); } } Output: String contains = GeeksforGeeks Contribute Reference: https://docs.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.tostring?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article StringBuilder.ToString Method in C# K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-StringBuilder-Class Similar Reads Single.ToString() Method in C# | Set - 2 Single.ToString() Method is used to convert the numeric value of the current instance to its equivalent string representation. There are 4 methods in the overload list of this method as follows: ToString(String) Method ToString() Method ToString(IFormatProvider) Method ToString(String, IFormatProvid 2 min read Single.ToString Method in C# | Set - 1 Single.ToString() Method is used to convert the numeric value of the current instance to its equivalent string representation. There are 4 methods in the overload list of this method as follows: ToString(String) Method ToString() Method ToString(IFormatProvider) Method ToString(String, IFormatProvid 3 min read StringBuilder.CopyTo Method in C# This method is used to copy the characters from a specified segment of this instance to a specified segment of a destination Char array. Syntax: public void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count); Parameters: sourceIndex: It is the starting position in this ins 2 min read C# | Int32.ToString Method | Set - 1 Int32.ToString Method is used to converts the numeric value of the current Int32 instance to its equivalent string representation. There are 4 methods in the overload list of this method as follows:Here, we will discuss the first two methods. ToString(IFormatProvider) Method This method is used to c 2 min read C# | Int16.ToString Method | Set - 1 Int16.ToString Method is used to convert the numeric value of the current instance to its equivalent string representation. There are 4 methods in the overload list of this method as follows: ToString(IFormatProvider) Method ToString(String, IFormatProvider) Method ToString() Method ToString(String) 2 min read Like