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 ava  2  s  .  c  om*/
{
   public static void Main(string[] args)
   {

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

   }
}

Result