C#中的转义字符verbatim string
2021-06-19 22:05
标签:app nbsp eth not happy ted tar orm reference In a verbatim string (a string starting with In verbatim string literals ( Note that in the 2nd case (not a verbatim string literal), a See the C# string reference for more details and examples. 单纯的字符串的话,直接加\进行转义。但是在@开头的字符串中,使用""来表示" C#中的转义字符verbatim string 标签:app nbsp eth not happy ted tar orm reference 原文地址:https://www.cnblogs.com/chucklu/p/10270739.html@""
) to escape double quotes you use double quotes, e.g. @"Please press ""Ok""."
. If you want to do it with verbatim strings then you would do something like @"\"""
(that‘s 3 double quotes on the end there).@"..."
) a "
in the string value is encoded as ""
, which happens to also be the only escape sequence in verbatim strings.@"\""Happy coding!\""" // => \"Happy coding!\"
"\\\"Happy coding!\\\"" // => \"Happy coding!\"
\
is required before the \
and the "
to escape them and prevent their normal meanings.