Hello,

I am trying to create a collection that will store boolean relationships between a list of numbers. Normally I would create a 2d array but these numbers will always be dynamically changing. Sometimes there will be more numbers and sometimes less. What collection type can I use to store an unspecified amount of data that behaves like a 2d array??

I am trying to create a collection that will store boolean relationships between a list of numbers. Normally I would create a 2d array but these numbers will always be dynamically changing. Sometimes there will be more numbers and sometimes less. What collection type can I use to store an unspecified amount of data that behaves like a 2d array??

I recommend some kind of dictionary collection, where the keys are instances of a class that holds the two numbers, and the values are the Boolean relationship. It still works like a two-dimensional array because you're keying the collection using pairs of numbers, but you only have to put in the number pairs you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.