"Cholo Lennon" <ch*********@hotmail.comwrote in message
news:O2**************@TK2MSFTNGP05.phx.gbl...
>Why can't I safe_cast a Dictionary to an Object?
Generic::Dictionary<String^, String^Dict = gcnew
Generic::Dictionary<String^, String^>();
Object^ DictObject = safe_cast<Object ^>(Dict);
Anyone know why the compiler won't handle this syntax?
Dave
You have a mistake in your 'Dict' declaration. You have to declare it like
a
managed reference:
Generic::Dictionary<String^, String^>^ Dict = gcnew
Generic::Dictionary<String^,
String^>();
This should also work:
Generic::Dictionary<String^, String^Dict;
Object^ DictObject = %Dict; // managed address-of -- but managed
deference is still *, not ^ if I remember right
>
Regards
--
Cholo Lennon
Bs.As.
ARG