Reputation: 123
I am just trying to learn razor syntax for webmatrix and I am struggling with arrays and cant find any guidance, can someone show me where I am going wrong..cheers
@for(var i = 1; i < 13; i++) {
int[] new monthArray[i];
}
I need to create 12 arrays named as:
monthArray1
monthArray2
monthArray3
.......
monthArray12
Upvotes: 0
Views: 2040
Reputation: 8630
Why not just make a single two-dimensional array?
int[][] monthArrays = new int[12][];
@for (var i = 1; i < 13; i++) {
monthArrays[i] = new int[foo]; // foo is length of each array
}
Then, access the right array by month number.
For example, instead of monthArray3, you'd write
monthArrays[3] ... // do something with array
Upvotes: 1