[thelist] Re: ASPX: Syntax for Multi-Line String Variable
Robert Hanson
rhanson at mva.com
Wed Oct 6 17:25:02 CDT 2004
<snip>
I hope all this code looks like it should once I hit send... I'm putting
together a string variable which will become the body of an email:
emailBody = "The following was submitted from the Membership Application
form:<br><br> " & _
"First Name = " & first_name & "<br> " & _
"Last Name = " & last_name & "<br> " & _
"Address 1 = " & address_1 & "<br> " & _
</snip>
Use the StringBuilder object and the Format methods:
StringBuilder o = new StringBuilder();
o.AppendFormat("First Name = {0} <br>",first_name);
o.AppendFormat("Last Name = {0} <br>",last_name);
....
string s = o.ToString();
Much cleaner, and uses fewer resources too.
More information about the thelist
mailing list