Apologies for the trivial question, but im having problems with the examples i find on microsoft support website.
Could someone please show me how to declare the libraries require (above main) for the ArrayList so that i can just define it as such:
ArrayList a = new ArrayList();
I cant get the libraries for ‘ArrayList’ to be recognised?
Are you using C++/CLI (managed C++)? This class is not available in native C++, fyi.
std::vector is the closest native code equivalent.
If you are using C++/CLI then you have to add a reference to the required assembly (
System.Collections) in your project – right click the project in Solution Explorer, selectAdd Reference, pick from.Nettab.Then make it available to your code as shown below and in the MSDN examples:
See this one for Add method, for instance.