How do I write escape characters verbatim (without escaping) in C# using StreamWriter?
- by Joel
I'm writing a utility that takes in a .resx file and creates a javascript object containing properties for all the name/value pairs in the .resx file. This is all well and good, until one of the values in the .resx is
This dealer accepts electronic orders.
/r/nClick to order {0} from this dealer.
I'm adding the name/value pairs to the js object like this:
streamWriter.Write(string.Format("\n{0} : \"{1}\"", kvp.Key, kvp.Value));
When kvp.Value = "This dealer accepts electronic orders./r/nClick to order {0} from this dealer."
This causes StreamWriter.Write() to actually place a newline in between 'orders.' and 'Click', which naturally screws up my javascript output.
I've tried different things with @ and without using string.Format, but I've had no luck. Any suggestions?