Using for each loop with StringCollection
#include "stdafx.h"
#using <system.dll>
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Specialized;
void main()
{
StringCollection ^strcol = gcnew StringCollection();
array<String^>^ tmpstr = gcnew array<String^> {"Third", "Fourth" };
strcol->AddRange(tmpstr);
for each (String^ s in strcol)
Console::WriteLine(s);
}
Related examples in the same category