Try using escape sequence ('\')(back slash):
stringOriginal.replace("\\\\\\\\","\\\\");
Details here:
MSDN: Escape Sequences[
^]
But, I believe actual issue would be that you are worried that your string is showing as '
domainName\\\\myname' -> thinking this is wrong you want to correct it. But, this is perfectly fine. You don't need to do any change. '\' needs a escape sequence and CLR automatically applies it at the time of computation. While applying the value it will be '
domainName\\myname' only.
If you want to avoid confusion, define string with @ character.
Like:
string mypath = @"domainName\\myname";