473,395 Members | 1,668 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,395 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 1891
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.