mc-Things
mc-Products => mc-Module => Topic started by: Nick_W on February 09, 2017, 11:48:43 am
-
I have 7 arrays (listofbytes), and I was looking to find a way of making them into a 2D array. ie a listoflistofbytes.
I was looking at listofobject as a way of adding a listofbyte to a listofobject, so that I have a listofobject with 7 entries, each it's own listofbyte.
Would this work? I don't want to go too far down this route if it's a dead end. It's confusing enough with all the listof things to deal with, without getting into lists of lists...
Another thought was to use a class as a container for lists.
What do you think is the best way to make a 2D array?
-
The last time I dealt with a language that only had 1D arrays and I wrote a program with a 2D work around... I think it was a version of Basic on a Commodore PET of all things. Anyway, I wanted a 10x10 array, so I created an array of 100, then just made my index:
(Caveat: This is Pseudo Code-I'm at work, not in front of VStudio)
Dim myArray[100]
I = X+Y*10
V = myArray
Or something like that. You get the idea.
-
Yes you can add a ListOfByte to a ListOfObject. You can add every type to a ListOfObject because a ListOfObject contains Objects and you can represent every type into an Object. Value types are boxed to do this.
Getting data out requires casting.