[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 927
  • Last Modified:

Strongly typed C++ .NET dynamic vector/array/list

Hello Experts,

I'm trying to find the C++ .NET equivalent of vector<>, that I can use in a managed class.  If I try to make a vector<> member variable, it will not allow it in a managed class.

More specifically, I'm wanting to store arbitrary number of Strings, doubles, and also have a dynamic array of dynamic arrays of doubles.

I've discovered the "ArrayList" class, but that requires convoluted casting to and from .. due to it not being strongly typed.  Having been a C++ programmer for many years, this just feels wrong, and there has to be an easier way!  I still haven't even managed to figure out how to get doubles in and out of an ArrayList.

So, what is the "correct" .NET way to do this?

Thanks,
 Steve.
0
steveiam
Asked:
steveiam
1 Solution
 
AlexFMCommented:
You can use .NET generics: see List<T> type and System.Collections.Generic Namespace. List<T> is strongly typed ArrayList.
0
 
steveiamAuthor Commented:
Ahh... Its in .NET 2.0.  I was initially using 1.1, which doesn't have it.

Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now