problem with hashtable

Hey,

i have a problem with the hashtable-object. I have create an object of my own class. With this object i have filled the hashtable.
 
MyClass^ myObject = gcnew MyClass();


1
2
3
4
5
Hashtable^ myTable = gcnew Hashtable();
System::Double^ key;
//...
//on event
myTable->Add(key, myObject);


This works fine - i think. But now i like to get the object from the hashtable and there is the problem:
1
2
MyClass^ myObject2 = gcnew MyClass();
myObject2 = myTable[key]; //Error-Message 


If i try to compile, i get the following message

error C2440: '=': 'System::Object ^' can not convert in 'MyClass ^'


Can anybody help me, please?
Last edited on
Hello. This is the same advise I give to anyone programming in C++/CLI: Post @ the MSDN forums because only very few of the regulars here know C++/CLI. Most of use just do unmanaged C++. Good luck.
What does myTable[key]; return? apparently the pointers are not compatible.
Topic archived. No new replies allowed.