Use the ToString() method to convert StringBuilder to a string : StringBuilder : String C# Examples


C# Examples » String » StringBuilder »

 

Use the ToString() method to convert StringBuilder to a string









    
using  System;
using  System.Text;

class  MainClass
{
    public  static  void  Main()
    {
        StringBuilder  myStringBuilder  =  new  StringBuilder();
        
        
        myStringBuilder.Append("friends");
        
        string  myString2  =  myStringBuilder.ToString();
        Console.WriteLine("myString2  =  "  +  myString2);
    }
}
    
   
  
   



Output

myString2 = friends


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» StringBuilder