Remove all spaces in a string in C#

We can remove all the white space characters in a string by the following code.

stringtext.Replace(" ", string.Empty);


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.Replace(" ", string.Empty));            
        }
    }
}

Output:
MynameisForgetCode