Mega Code Archive

 
Categories / Visual C++ .NET / Collections
 

Assign string value to StringCollection by indexer

#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);     strcol[0] = "First";     strcol->Insert(1, "Second"); }