bugGNU source-highlight - Bugs: bug #34177, C# Verbatim String Literals


bug #34177: C# Verbatim String Literals

Submitted by:  John Gietzen <otac0n>
Submitted on:  Tue 30 Aug 2011 08:52:59 PM UTC  
Votes:  100  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Tue 30 Aug 2011 08:52:59 PM UTC, original submission:

In the C# language file, the only supported strings are C++ style strings. However, C# has a string format called "Verbatim String Literals.":

string foo = "a\\b\\c";

is equivalent to:

string foo = @"a\b\c";


string bar = "a\"b\"c";

is equivalent to:

string bar = @"a""b""c";

Basically, any character other than a double-quote is handled as though it is part of the string. Double-quotes are doubled-up to encode a double-quote character.

The EBNF for string literals in C# is available here:

John Gietzen <otac0n>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by philomelus (Voted in favor of this item)
  • -unavailable- added by otac0n (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 100 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 29 Aug 2012 06:28:13 PM UTCphilomelusCarbon-Copy-=>Added philomelus

    Back to the top

    Powered by Savane 3.1-cleanup