JsonConfig icon indicating copy to clipboard operation
JsonConfig copied to clipboard

Reading Strings with "\" in them

Open Zapnologica opened this issue 8 years ago • 1 comments

I have a db connection string in my config file:

Connection: "localhost\sqlexpress"

but when I debug. in code the variable is " localhostsqlexpress" (no "" )

and if put two "" then both of them appear in the variable?

is there a special way I need to read the string?

Zapnologica avatar May 04 '16 08:05 Zapnologica

To read the string you need to escape "". Your config file should look similar to this: { "Connection" : "localhost\\sqlexpress" } The Debug breakpoint will display "localhost\\sqlexpress". However, try printing it to console. It should print "localhost\sqlexpress".

ralsu091 avatar Jun 06 '16 19:06 ralsu091