# How to declare tree-dimentional array list

Hi

How can I declare a list with 3 dimensional array with prices like showed in a table below:

Rgonzo1971

HI,

pls try
``````        int[, ,] array3D = new int[,,] { { { 1, 1, 50 }, { 1, 2, 50 } , { 1, 3, 50 }, { 1, 4, 50 }, { 1, 5, 50 } },
{ { 2, 1, 50 }, { 2, 2, 50 } , { 2, 3, 50 }, { 2, 5, 50 }, { 2, 5, 50 } } };``````
Regards
int[,] items = new int[2,10];

items[0,0]=1;
items[1,0]=1;
items[2,0]=50;
...
items[2,10]=60;
Hi

3d data corrected
``````        int[, ,] array3D = new int[,,] { { { 1, 1, 50 }, { 1, 2, 50 } , { 1, 3, 50 }, { 1, 4, 50 }, { 1, 5, 50 } },
{ { 2, 1, 55 }, { 2, 2, 55 } , { 2, 3, 55 }, { 2, 5, 55 }, { 2, 5, 55 } } };``````
and 2D
``        int[,] array2D = new int[,] { { 50, 50, 50, 50, 50 }, { 55, 55, 55, 55, 55 } , { 60, 60, 60, 60, 60 } };``

Thanks a lot for the response...

Array list have to be based on 1-10 kilos on one axis and 1-5 packages on other axis, 3 axis with the price

Price for each package starts at 50,- krones for one kilogram and continues upward by 5,- krones extra per. kilo. Assume that there is only whole kilogram.
then try (array is Zero based)

``````        int[,] array2D = new int[35,5] ;
for (int i = 0; i <= array2D.GetUpperBound(0);i++)
{
for (int j = 0; j <= array2D.GetUpperBound(1); j++)
{
array2D[i, j] = 50 + (5 * (i));
}
}  ``````
Price for each package starts at 50,- krones for one kilogram and continues upward by 5,- krones extra per. kilo. Assume that there is only whole kilogram.

Why do you need a array, when it could be calculated as 50 + 5 * weight?

Maybe I do not need an array and calculate as you say, but I have to display a list with correct prices in a GUI, html table or GRID...
Can you please give us a concise and complete description of your problem?

Just to make it clear: "GUI, html table or GRID..." isn't really exact.

UI  will list up prices in a two-dimensional table based on 1-10 kilos on one axis and 1-5 packages on other axis, and 3 axis with the price....

simple display it in User interface....

just want to display the list.....

``````int[,] array2D = new int[35,5] ;
for (int i = 0; i <= array2D.GetUpperBound(0);i++)
{
for (int j = 0; j <= array2D.GetUpperBound(1); j++)
{
array2D[i, j] = 50 + (5 * (i));
}
} ``````

This code is working fine, only thing is that I have to start from 12345, and not 01235

How can I fix that it declare array starting from 12345?
ste5an

membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.