Remove trailing spaces in a string using TRIM in C#

TrimEnd() will remove only the trailing white space characters.

Syntax:
stringtext.TrimEnd();


Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ForgetCode
{
    class Program
    {
       static void Main(string[] args)
        {
            string text = "  My name is Forget Code  ";
            Console.WriteLine(text.TrimEnd());            
        }
    }
}


Output:
(With only leading spaces not trailing spaces)
My name is Forget Code