开发者

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开发者_StackOverflow社区)


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^>^();


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.


StringCollection for instance, or

List<String>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜