Ok, here goes:
// Create a StringBuilder
StringBuilder builder = new StringBuilder();
// Add some text
builder.Append("Some text.");
// Add an integer
int answer = 42;
builder.Append(answer);
// Add a line break
builder.AppendLine();
// Things like dates and floating point values should be formatted
builder.AppendFormat("yyyy-MM-dd HH:mm:ss", DateTime.Now);
// You can stack appends
builder.Append("Number ").Append(answer).AppendLine(" again");
// Finally get the complete string
string message = builder.ToString();
James Page wrote:
Thanks for your reply.
Could you give an example of a "string builder" I'm fairly new to asp.net 2.0
"Göran Andersson" wrote:
>If you could convert a dictionary into a string, it would end up as one
long string of values, without line breaks or anything. That's probably
not what you want anyway.
Create a StringBuilder, loop through the items in the dictionary and add
the text for each item to the StringBuilder.
James Page wrote:
>>Hi all
I have a shopping cart object which I'd like to send the contents via an
e-mail.
I get an error saying 'hybridDictionary' cannot be converted to string.
Does anyone know how to do this or point me in the right direction?
Thanks