You should assign result of replacement:
var res = variable. Replace("\\", "https://stackoverflow.com/"); // you need "\\" because "\" is escape symbol.
or
var res = variable.Replace(@"\", "https://stackoverflow.com/");
3
solved Replace all blackslashes with forward slash [duplicate]