473,378 Members | 1,621 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,378 software developers and data experts.

How to convert a Dictionary<int, double> to an array?

I am trying to convert a Dictionary into an array so that I can compare
values and compare keys individually.

I am looking for a solution like array[array] i.e array of array.
Mar 1 '08 #1
2 2450
amir wrote:
I am trying to convert a Dictionary into an array so that I can compare
values and compare keys individually.

I am looking for a solution like array[array] i.e array of array.
- convert dic.Keys to int[]
- convert dic.Values to double[]
- store both arrays in object[]

I doubt that it is a good idea to convert to that format.

Arne

Mar 1 '08 #2
I did that already but thought, may be there is a smarter way than that so
that I can compare values easily in the int[]

"Arne Vajhøj" wrote:
amir wrote:
I am trying to convert a Dictionary into an array so that I can compare
values and compare keys individually.

I am looking for a solution like array[array] i.e array of array.

- convert dic.Keys to int[]
- convert dic.Values to double[]
- store both arrays in object[]

I doubt that it is a good idea to convert to that format.

Arne

Mar 1 '08 #3

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

Similar topics

1
by: Ingo Nolden | last post by:
Hi, I am using spirit 1.31 I have been trying the following example from the spirit docs. I tried it with int and double neither works: vector<int> v; rule<> r = list_p(int_p, ch_p(',')); ...
20
by: Anonymous | last post by:
Is there a non-brute force method of doing this? transform() looked likely but had no predefined function object. std::vector<double> src; std::vector<int> dest; ...
10
by: bluekite2000 | last post by:
and why doesnt the standard vector have such conversion available?
9
by: richard_lavoie | last post by:
Hi, I have something like this: vector<floatvec1; and I want to cast it, so I use vector vec2<double= static_cast< vector<double(vec1); I always become a error: syntax error before `>'...
2
by: per9000 | last post by:
Hi, *background* I want a class containing an int (a list of sets of integer). This should be hidden for the user and he/she should be able to insert his/her favourite data structure so to be a...
5
by: J.M. | last post by:
I am trying to use a software package in my program, the problem being different methods are used to store vectors. I have "my" vectors stored as vector<doublefrom the STL and need to pass a...
10
by: arnuld | last post by:
It is quite an ugly hack but it is all I am able to come up with for now :-( and it does the requires work. I want to improve the program, I know you people have much better ideas ;-) /* C++...
15
by: hsachdevah | last post by:
Hello, I am trying to create a dictionary item with its key as list type and value as custom object type. It gives me a error "An item with the same key has already been added." Here is my code:...
1
by: hanna88 | last post by:
what's the best way to convert a list of string to a vector<int>? what i have now is for loop and iterate each char in the string string base=""; //i have vector<int>row,vector <...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.