CSharp - String String replace

Introduction

Replace method replaces all occurrences of a particular character or substring:

Demo

using System;
class MainClass//w w w .  j a va  2 s.  com
{
   public static void Main(string[] args)
   {

     Console.WriteLine ("this is a test".Replace (" ", " | ") );  
     Console.WriteLine ("this is a test".Replace (" ", "")    );  

   }
}

Result