C# verbatim strings vs. PowerShell here-strings

C# verbatim strings and PowerShell here-strings have just enough in common to be confusing. The differences are summarized here.

C# verbatim stringsPowerShell here-strings
May contain line breaksMust contain line breaks
Only double quote varietySingle and double quote varieties
Begins with @”Begins with @” (or @’) plus a line break
Ends with “Ends with a line break followed by “@ (or ‘@)
Cannot contain un-escaped double quotesMay contain quotes
Turns off C# escape sequences@’ turns off PowerShell escape sequences but @” does not

Leave a Reply

Your email address will not be published. Required fields are marked *