Soren Norbaek
Soren Norbaek

Reputation: 13

CLR equivalent to MFC CStringList

Hey. I'm trying to get this code http://www.codeguru.com/Cpp/W-P/files/inifiles/article.php/c4455/#more to compile under a CLR WinForms app I'm making. But what is the right syntax? A CString under CLR is to be written System::String but what about CStringList? (I figure it's a string array)

Upvotes: 1

Views: 693

Answers (3)

Frederik Gheysels
Frederik Gheysels

Reputation: 56964

StringCollection for instance, or

List<String>

Upvotes: 0

President James K. Polk
President James K. Polk

Reputation: 42009

You should use one of the types from System.Collections.Generic, for example System.Collections.Generic.List

There is a simple example at the bottom of that page.

Upvotes: 0

Idan K
Idan K

Reputation: 20881

What do you mean by CLR equivalent?

If you mean plain C# then this will do:

string[] arr = new string[size];

or:

List<String> list = new List<String>();

If you mean C++/CLI by CLR equivalent then something like this should work:

array<String^>^ arr = gcnew array<String^>(size);

or:

List<String^>^ list = gcnew List<String^>^();

Upvotes: 2

Related Questions