How do I escape strings in C#? I have strings which are the bytes from a PNG and I need to escape them correctly in code to avoid compile errors…Any ideas?
So here is the type of code, I have which doesn’t compile
public const string s =
"wewegliwewejwqejsadaskjda" +
"wewegliwewejqejsadaskjda" +
"wewegliwewejejsadaskjda" ;
The code you’ve given will compile, except that you’ve used
constantinstead ofconst. (Admittedly that’s not valid Base64, as it contains the padding = character in the middle rather than at the end.) If this doesn’t help, please post an example with this problem corrected but that still doesn’t compile.As Neil said, none of the characters in Base64 need escaping in C#.