In Visual Studio with C#, how can I declare a string inside of a string like this? I saw a few Stack Overflow pages like "Java string inside string to string", but didn't think any of them were the same as my question.
Basically if I have
"<?xml version="1.0" encoding="UTF-8"standalone="yes" ?>"
How can I declare this, or something like it, in my code as a string? Someone suggested double quotations to me around things like ""1.0"", but I couldn't get that to work.
Thanks for the help.
Either escape the double quotes like this:
"<?xml version=\"1.0\" encoding=\"UTF-8\"standalone=\"yes\" ?>"
or use a verbatim string (notice the leading @ symbol in front of the string) like this:
@"<?xml version=""1.0"" encoding=""UTF-8""standalone=""yes"" ?>"
Either:
@"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes"" ?>"
or
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
or more simply; use single quotes!
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With