Does this code takes x and changes its contents directly or creates a temporary new string then copy to x?
If the latter is true, I don't understand why we use ref.
public static void RemoveSpaces(ref string x)
{
x = x.Replace(" ", "");
}