Mega Code Archive

 
Categories / Visual C++ .NET / Collections
 

Get key and value Enumerator

#include "stdafx.h" #using <system.dll> using namespace System; using namespace System::Collections; using namespace System::Collections::Specialized; void main() {     ListDictionary ^ldict = gcnew ListDictionary();     ldict->Add("A", "First");     ldict->Add("B", "Second");     ldict->Add("C", "Third");     ldict["D"] = "Fourth";          IEnumerator ^keys = ldict->Keys->GetEnumerator();     IEnumerator ^vals = ldict->Values->GetEnumerator();     while ( keys->MoveNext() && vals->MoveNext())     {         Console::WriteLine("{0}\t\t{1}", keys->Current, vals->Current);     } }