Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Replacing \ with / using Regex.Replace in C#

Using Regex also, we can replace special characters.
While using Regex, the user must explicitly specify to ignore the special characters (Escape sequences).

using System;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;

public class ForgetCode
{
    public static void Main()
    {
        string str = @"C:\home\level\one";

        string newstr = Regex.Replace(str, @"\\", "/");

        Console.WriteLine("Input: "+str);
        Console.WriteLine("Output: "+newstr);     
    }
}

Output:
Input: C:\home\level\one
Output: C:/home/level/one