I suggest you ...

Allow to have custom delimiters in raw string literal

C++11 (and some others languages) allow you to define custom delimiters for litterals string. It allows you to copy and paste xml, html , ... easily in you code without have to double " .
For inst(taken from wikipedia on c++11)

R"(The String Data \ Stuff " )"
R"delimiter(The String Data \ Stuff " )delimiter"

156 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    ManuManu shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Halo_FourHalo_Four commented  ·   ·  Flag as inappropriate

        I'd also like to see C# get raw string literals. I'm not terribly fond of C++'s syntax as I think it's weird that the delimiter appear within the double-quotes. I've proposed the following syntax on the Roslyn issues on Github:

        string s1 = @("contents here");
        string s2 = @(raw"contents here"raw);

        The syntax is @( followed by an optional custom delimiter which is any valid identifier name, followed by a double quote. The raw string literal comes after that double quote. The sequence that terminates the literal is a double quote immediately followed by the optional custom delimiter and finally a close parenthesis.

        https://github.com/dotnet/roslyn/issues/2239

      • ManuManu commented  ·   ·  Flag as inappropriate

        IDE tools would then make editing a bit more cumbersome than supporting this feature in the language.
        Extra format that could benefit from this are json, multiline csv, ...

      • JuJu commented  ·   ·  Flag as inappropriate

        Actually, having the IDE escaping the double quotes would still make the text hard to read...

        A custom delimiter is definitly the way to go.

      Feedback and Knowledge Base