hashtable

Jedhi

Centurion
Joined
Oct 2, 2003
Messages
127
I have a hashtable where I have added something into it.

hastht.Add(no, new object[2]{class, command}

IDictionaryEnumerator myEnumerator = cmdqueue.GetEnumerator();
myEnumerator.MoveNext();
_key = myEnumerator.Key;

_value = myEnumerator.Value;


The _value contains class and command that I wish to get, but if I try

object[] xxx = (object[])_value;

I get the error that the cast is invalid. How do I solve this !
 
If you step through this in a debugger what is the value of _value when you get the error?

Also storing object arrays inside a HashTable is probably not going to win any 'Best OO Practices' awards, if you give a bit more detail about what you are trying to do there may be a better / easier way to handle the problem
 
the object _value is
[0]
[0] class
[1] command

Please let me know what you would suggest to follow the 00 Practices.
This is what I have to do:

I have a device that can sleep and later wake up. When I ask the device to operate a command and it is sleeping, I want to save its number, it class and command, so that when it later wakes up it reads from the hashtable or whatsoever to fullfill the command.

How would you suggest me to do that ?
 
Back
Top