Mar 26, 2012 at 1:08pm UTC
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 Mar 26, 2012 at 1:22pm UTC
Mar 26, 2012 at 1:42pm UTC
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.
Mar 26, 2012 at 2:40pm UTC
What does myTable[key]; return? apparently the pointers are not compatible.