Hi,

I wonder what the way is to remove dublettes from a List. ?
I have filled a List like this:

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

List1->Add("123");
List1->Add("124");
List1->Add("123");

You must be using old version of visual studio. The current version does not use pointers, but the ^ operator

List<String^>^ List1 = gnew List<String^>;
// etc

Upgrade to either 2008 or 2010 so that you can use newest version of C++/CLR language.

As for your question, probably do it like you would anything else. Iterate through the list to find duplicates and delete them when found. You would need two loops for that.

Edited 7 Years Ago by Ancient Dragon: n/a

Okay, I will check it out.
I understand how I can do it with 2 loops. I was just hoping for if there was any type of function for this etc.

Thanks for help!

You must be using old version of visual studio. The current version does not use pointers, but the ^ operator

List<String^>^ List1 = gnew List<String^>;
// etc

Upgrade to either 2008 or 2010 so that you can use newest version of C++/CLR language.

As for your question, probably do it like you would anything else. Iterate through the list to find duplicates and delete them when found. You would need two loops for that.

That is the std:: namespace and I doing the code in managed. Thanks.

How about std::set?

This question has already been answered. Start a new discussion instead.