cpp C++/CLI .NET 2.0if (pets->ContainsKey("bill"))
{
String^ value = safe_cast<String^>(pets["bill"]); pets->Remove("bill");
Console::WriteLine("{0}", value);
}
using namespace System;
using namespace System::Collections;
int main()
{
Hashtable^ pets = gcnew Hashtable;
pets->Add("joe", "cat");
pets->Add("mary", "turtle");
pets->Add("bill", "canary");
if (pets->ContainsKey("bill"))
{
String^ value = safe_cast<String^>(pets["bill"]); pets->Remove("bill");
Console::WriteLine("{0}", value);
}
}