|
Hi all
Can i retrive from hashtable objects in those seqency in which ones had been added to one.
I mean
<br />
<br />
ht.Add("key1", object1);<br />
ht.Add("key2", object2);<br />
ht.Add("key3", object3);<br />
<br />
foreach(DictionaryEntry de in ht)<br />
{<br />
WriteLine(de.Key);<br />
}<br />
<br />
------------------<br />
result can be as this:<br />
<br />
key3<br />
key2<br />
key1<br />
<br />
how i can do what:<br />
<br />
key1<br />
key2<br />
key3<br />
<br />
Thank
|
|
|
|
|
I don't believe so, no. A hash table, by definition, stores according to hashes. If you need the order, you need to store them in a list or something as well.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I belive in what i saw
When in watch window i debug this hashtable i saw what all entries walk in ordem in which i add ones .Since what i think should exist any mechanism for retrive ones in same ordem.
Please ,any key ,get me opinion :
i need any ordered collection and simulatently
key-value-pares in one. Which type of collection i should use.
Thank.
-- modified at 5:23 Thursday 3rd August, 2006
|
|
|
|
|
A hashtable does not retain the order that the items were added in. If the items were displayed in the same order you added them, it was a coincidence.
---
b { font-weight: normal; }
|
|
|
|
|
You can make sure in this. Try to oneself.
When displayed items in ordem, when retrived not.
ht.Add("one", null);
ht.Add("two", null);
-----
Displayed:
ht
["one"]
["two"]
------
Retrived
two
one
-- modified at 5:51 Thursday 3rd August, 2006
|
|
|
|
|
Use SortedList instead of Hashtable.
|
|
|
|
|
Thank think this is exactly what i need
|
|
|
|
|
hi all i have this pro on hand now.. i have downloaded some sample database applications from the internet..however when i want to debug it i gives me the error--An unhandled exception of type "system.Data.OleDb.OledbException" occurred in system.data.dll
and also the database is in access format but when i want to open it it gives a message--the file is located outside yr intranet or on an untrusted site. Microsoft Access will not open the file due to potential security problems.TO open the file, copy it to yr machine or an accessible network location.
i inferred that this errors occur due to where the dB file is located..is it correct? can someone out there help will this pro? and maybe guide me to correcting it ..thanks in advance..
|
|
|
|
|
Probably you need to right click the MDB file and mark it as trusted, it's probably marked as having come from the web.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi u are right! i can access the DB now but my application still have debugging errors with the same message which i first posted here.. how can i solve it??
|
|
|
|
|
Well, now we're at the point where you need to tell us the error and post some code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
can u share he link with me from where u downloaded that sample applications with databse please
|
|
|
|
|
Hi all,
How to select a particular treenode in TreeView using index or object
|
|
|
|
|
this.treeView1.SelectedNode = this.treeView1.Nodes[0];
|
|
|
|
|
Hi,
It should be possible to get the scoll lock key status (ON or OFF) in javascript. any one help me out.
thanks in advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
I doubt that very much. It sure has nothing to do with C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
So u want to use Scroll Lock Key.
That's great.
Just inform these peaples.
-- modified at 5:16 Thursday 3rd August, 2006
And use right board for right forum (java forum)
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Hello,
Im wondering how to merge two different List<> into one?
List1
1, Green
2, Blue
3, Red
4, Black
List2
1, 11
2, 22
3, 33
4, 44
result
List1 (after merge)
1, Green, 11
2, Blue, 22
3, Red, 33
4, Black, 44
I now it´s possible in C# 3.0 (http://blogs.msdn.com/abhinaba/archive/2005/09/15/467926.aspx) but i cant use that! It must be a way to solve this, I don´t give up;)
/Albin
|
|
|
|
|
The article shows the use of extension methods and the presented Merge method doesn't merge the two list as you're planning to do it. It only appends the elements of the second list to the first one.
In your case after the merging List1 has a different type (3 values per entry instead of 2). Of what type are the elements of these lists? By what you provided it seems they all are of different types, so I think it would be best to create a third list by iterating over the first two and creating the elements of the third list from their elements.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
List 1 has class with construcors so yes we can reuse List 1 in my case.
List1(int, string)
List1(int, string, int)
So Im wonder HOW to merge these two lists. Like Joins in SQL
please any idea
|
|
|
|
|
I think the best would be iterating over the lists and either create new items or assign the second int if accessible.
for (int index = 0; index < List1.Length; index++)
{
List1[index] = new Class1(List1[index].firstIntVar, List1[index].string, List2[index].SecIntVar);
List1[index].SecIntVar = List2[index].SecIntVar;
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
well guys hello!!
jus wanted to know that there is compiles project i got from my senior, but it has not database and gives me errors, i feel like not makin whole of the tables again.. i found there is a file with .pdb extension in debug folder, "program debug database" .
Is it the real database, or what it is ??
can u help me guyzz
<<realin wuz="" here="">>
|
|
|
|
|
As the name implies the pdb-file holds information for debugging (afaik to give you filenames and linenumbers if errors occur). So either you get the "real" database from your senior or you'll have to rebuild it.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
really thanks a lot mate..
jus a lil help, can u tell me a website or a source from i can get ready made projects, cause i m some what short of time, i can recode it though at my own,.. thanks in advance
|
|
|
|
|
realin wrote: a website or a source from i can get ready made projects
www.codeproject.com
All jokes aside, what do you mean by that? There are many sources in the internet that provide completed projects for certain purposes (CP is only one of them).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|