getting the error
error CS1009: Unrecognized escape sequence
string to be replaced
newDate = "/Date(1430370000000+0530)/"
Code
newDate.Replace("/","\/")
I am trying to replace a backslash
/
with forward and backward slash
\/
getting the error
error CS1009: Unrecognized escape sequence
string to be replaced
newDate = "/Date(1430370000000+0530)/"
Code
newDate.Replace("/","\/")
I am trying to replace a backslash
/
with forward and backward slash
\/
I believe you want
newDate.Replace("/","\\/")
as \ has special meaning and you used it improperly causing the quoted error. See escape character for more details.
Alternatively try verbatim literal using @-quoting:
newDate.Replace("/", @"\/")