473,320 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

convert hybridDictionary to string

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
Jul 1 '06 #1
4 1888
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
Jul 1 '06 #2
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
Jul 2 '06 #3
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
Jul 3 '06 #4
Thanks Göran I'll try that

James

"Göran Andersson" wrote:
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
Jul 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul | last post by:
Hi all. I have a class with inherits the HybridDictionary object and when i am binding this to a datagrid for example using the "Values" object I want to have some way of sorting the results....
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
3
by: William Stacey [MVP] | last post by:
I take it the reason HybridDictionary may be faster then a normal Hashtable with 10 items is less is the cost of generating hashcodes ? Other reasons? -- William Stacey, MVP
1
by: Paul Tomlinson | last post by:
All, I have a very simple class and all I want to do is override the add and remove methods for logging, thats it. This is my class, however the only methods which I can override are equals,...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
3
by: Mark S. | last post by:
The app gets about 300 requests per second during peak hours. The part of the app in question acts like a "lookup table", but isn't tied to a database. My reading on the subject, and my test code,...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.