I had a project in vb.net that used XML Literals
to process large blocks of SQL like so:
Dim SQL As String = <a> Use test
alter table BarFoo alter column CouponName nvarchar(328)
alter table Foo alter column IngredientName nvarchar(328)
alter table Bar alter column IngredientShortDescription nvarchar(328)
alter table FooBar alter column ItemName nvarchar(328) </a>.Value
But cant seem to find its equivalent for C# Any suggestions?
There are three ways to create strings that span multiple lines: By using template literals. By using the + operator – the JavaScript concatenation operator. By using the \ operator – the JavaScript backslash operator and escape character.
They are called Raw Strings. They can span multiple lines without concatenation and they don't use escaped sequences. You can use backslashes or double quotes directly. For example, in Kotlin, in addition to regular string literals, you can use Raw Strings with three double quotes """ instead of just one.
The most common way is to enclose the string between double quotes, e.g., "foo bar" . Strings can span multiple lines. The special characters " and \ and the character sequence ${ must be escaped by prefixing them with a backslash ( \ ).
You can prefix a string constant with @
to span multiple lines. The only thing that would need to be escaped is quotes (using the double quote).
string SQL = @"Use test
alter table BarFoo alter column CouponName nvarchar(328)
alter table Foo alter column IngredientName nvarchar(328)
alter table Bar alter column IngredientShortDescription nvarchar(328)
alter table FooBar alter column ItemName nvarchar(328)";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With