Heredoc strings in C#

后端 未结 3 1198
再見小時候
再見小時候 2021-01-17 09:38

Is there a heredoc notation for strings in C#, preferably one where I don\'t have to escape anything (including double quotes, which are a quirk in verbatim strings

3条回答
  •  悲&欢浪女
    2021-01-17 09:55

    No, there is no "HEREDOC" style string literal in C#.

    C# has only two types of string literals:

    • Regular literal, with many escape sequences necessary
    • Verbatim literal, @-quoted: doublequotes need to be escaped by doubling

    References

    • csharpindepth.com - General Articles - Strings
    • MSDN - C# Programmer's Reference - Strings

      String literals are of type string and can be written in two forms, quoted and @-quoted.

提交回复
热议问题