Comparing String Builder objects in C#

You can directly compare two or more String Builder objects without converting to anything else.

using System;
using System.Text;

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

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

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

            if (sb1.Equals(sb2))
            {
                Console.WriteLine("Matches");
            }
            else
                Console.WriteLine("Not Matching");

               
        }
    }
}


Output:
Matches

using System;
using System.Text;

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

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

            StringBuilder sb2 = new StringBuilder("Time is silver");

            if (sb1.Equals(sb2))
            {
                Console.WriteLine("Matches");
            }
            else
                Console.WriteLine("Not Matching");

               
        }
    }
}


Output:
Not Matching