Remove spaces in a string using TRIM in C#

TRIM() function will trim the string text (Only at beginning and trailing spaces)

Syntax:
stringtext.TRIM();


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.Trim());            
        }
    }
}


Output:
With no spaces at leading and trailing
My name is Forget Code