Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Clearing content of String Builder in C#

You can clear the content by clear() method of string builder object.

using System;
using System.Text;

namespace forgetCode
{    
    class program
    {        
        public static void Main()
        {            

            StringBuilder sb1 = new StringBuilder("Time is gold");         

            sb1.Clear();

            Console.WriteLine(sb1);
                           
        }
    }
}


Output:
No text (Empty since the content was cleared)