TrimEnd in C#

Using TrimEnd, we can trim the spaces only in the end of string.

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

namespace forgetCode
{
    class program1
    {
        static void Main(string[] args)
        {
            string s1 = "    Forget code      ";

            string s2 = s1.TrimEnd();

            // ! is added here to see the space present or not

            Console.WriteLine("!" + s2 + "!");

        }
   
    }
}


Output:

! Forget code!


..