ShippingConfirmationLabel.Text = _
string.Format("Using {0} shipping to:<br>", _
ShippingTypeRadioButtonList.SelectedValue);
This however works fine:
ShippingConfirmationLabel.Text = "Using " + ShippingTypeRadioButtonList.SelectedValue + "
shipping to:<br>";
Sorry if this question has been asked earlier however upon searching nothing concrete came up for this. For some reason that code doesn't let me compile in VS.
Cheers Andrew
The backslash character ('') is the line continuation character. It must be the last character on a line. The preprocessor joins lines ending with a line continuation character into a single line (for purposes of preprocessing and compilation).
The line continuation character in IPL and JavaScript is the backslash (\). You use this character to indicate that the code on a subsequent line is a continuation of the current statement. The line continuation character helps you format your policies so that they are easier to read and maintain.
Use Shift+Enter to start a new line after the current line Use the key combination Shift+Enter to start a new line below the current line.
There is no Line Continuation Character
in C# like in VB.NET
In C# exist the ;
to delimit the end of an instruction.
This means that there is no need for a line continuation character since a line is not considered over until you reach a semi colon (";").
The +
is the string concatenation operator and it does not means Line Continuation Character
ShippingConfirmationLabel.Text =
"Using " +
ShippingTypeRadioButtonList.SelectedValue +
"shipping to:<br>";
As you can see, you could break the line at every point you like (of course not in the middle of a keyword or identifier) and close it with the ;
terminator.
Sometimes, for legibility or other reasons, you want to break apart a single string on different lines.
In this case you could use the string concatenation operator.
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