Skip to content

Clarifications regarding two of the listed string literal rules #34192

@burnchar

Description

@burnchar

I believe this document is good overall but can use a few clarifications:

Both opening and closing quote characters must be on their own line.
Whitespace only lines following the opening quote are included in the string literal.

What does "On their own line" mean?
The code example immediately preceding this rule begins with:
var xml = """
Are those quotes "on their own line" despite being on the same line as the variable declaration?
Either way, is the whitespace that follows that initial line included in the string literal?

var xml = """  // Is this whitespace included in the string literal? This is a "whitespace only line"
        <element attr="content">
            <body>
            </body>
        </element>
        """;

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 478687

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.dotnet-csharp/svcin-prThis issue will be closed (fixed) by an active pull request.lang-reference/subsvcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions