How To convert 1D array to 2D array in C# -
i have:
string snacks="chocolate,alwa,samosa,channa";
i need array like:
snacks= {"chocolate,alwa" , "samosa,channa"};
in c#.
could pls suggest way find snacks
string snack2[][]=new string[math.round(snacks.length/2)][2]; int cnt=0; for(int i=0;i<math.round(snacks.length/2);i++) { (int j=0;j<2;j++) { snacks2[i][j]=snack[cnt++]; } }
Comments
Post a Comment