I’m just starting to learn c# and I’m having trouble with arrays. The array I want will be multidimensional, but I’m not sure of the proper way to set it up. There will be a total of three dimensions in this array and if it were printed out it would look similar to this:
1, 23, 6.4
1, 29, 1.0
1, 3, 8.68
1, 12, 0.001
1, -5, 0
2, 83, -5
2, 5, 14
2, 19, -12.5
2, 62, 8
2, 81, 1
3, 0, 1.4
3, 11, 1.7848
3, 55, 64.4
3, 82, 23
3, 6, 73.4
Dimension 1 will have a variable number of sets (would be pulled from a database)
Dimension 2 will always have 5 sets
Dimension 3 will always have 1 set
Any help would be appreciated.
[UPDATE]
I was in a hurry when I originally posted this so I didn’t have time to explain fully what this will be used for. Here is some additional information…
Each day people sort through boxes of parts and take a measurement of the parts. Each box has 5 parts that need to be measured.
B1 -> P1:M, P2:M, P3:M, P4:M, P5:M
B2 -> P1:M, P2:M, P3:M, P4:M, P5:M
B3 -> P1:M, P2:M, P3:M, P4:M, P5:M
.
.
.
Bn -> P1:M, P2:M, P3:M, P4:M, P5:M
Where “B” is the information on the box (box serial_no), “P” is the information about each part (part_no), and “M” is the measurement of each part. There will always be 5 parts in a box and we will take only one measurement on each part, but there will be a variable amount of boxes.
Before I posted I had already done research on arrays ( [] ), multidimensional arrays ( [,] ), jagged arrays ( [][] ), lists and a combination of all of them. I know with arrays you have to specify the size of each dimension whereas with lists you can add more to them.
Is there a way I could combine a 2D (which would hold the measurement information for each part) and a list (which would hold the list of boxes)?
The box information will be int, the part information will be int, but the measurement will be double.
This is what I ended up doing:
If I want to see what is in “N” I can do this: