Trim in C#

We can trim the spaces using trim() in C#.

using System;
using System.IO;
using System.Text;

namespace forgetCode
{
    class program1
    {
        static void Main(string[] args)
        {

            string s1 = "Forget code      ";

            string s2 = s1.Trim();
             
        // ! is added here to see the space present or not
                      
            Console.WriteLine(s2+"!");

        }
   
    }
}


Output:
Forget code!

..