cpp C++/CLI .NET 2.0if (pets->ContainsKey("mary")) Console::WriteLine("ok");
using namespace System;
using namespace System::Collections;
int main()
{
array<String^>^ input = {"joe:cat", "mary:turtle", "bill:canary"};
Hashtable^ pets = gcnew Hashtable; array<Char>^ sep = {':'}; array<String^>^ currentry;
for each(String^ entry in input)
{
currentry = entry->Split(sep, StringSplitOptions::RemoveEmptyEntries);
pets->Add(currentry[0], currentry[1]);
}
if (pets->ContainsKey("mary")) Console::WriteLine("ok");
}