c# - How to get the value of a two dimensional array in Razor? -
i have jagged array shown below, , array inside c# code:
@{ int[][] array = new int[2][4]; // codes here manipulates values of array. }
now want get/traverse values in array. code below don't work. when run program got run-time error "index outside bounds of array."
for(var = 0 ; < @array.count(); i++){ alert( '@array['i'].length'); }
how that?
thanks
try like
foreach(var subarray in array) { @:alert(subarray.length); }
but wont length same since statically declared?
Comments
Post a Comment