-4

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

\/
SmartestVEGA
  • 8,415
  • 26
  • 86
  • 139

1 Answers1

0

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("/", @"\/")
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141