Mega Code Archive

 
Categories / Visual C++ .NET / Collections
 

Does an ArrayList contain a value

#include "stdafx.h" using namespace System; using namespace System::Collections; void main() {     ArrayList ^alist = gcnew ArrayList(4); // will double to 8     alist->Add("One");     alist->Add("-");     array<String^>^ morenums = gcnew array<String^> {"Four", "Five"};     alist->AddRange(morenums);     Console::WriteLine("\n\nCapacity is: {0}", alist->Capacity.ToString());     alist->Capacity = 10;          Console::WriteLine("New capacity is: {0}", alist->Capacity.ToString());               bool fnd = alist->Contains("One");     Console::WriteLine("ArrayList contains a 'One': {0}", fnd.ToString());      }