Prakash Prakash - 4 months ago 43
C# Question

How To convert 1D array to 2D array in C#

I have:

string snacks="Chocolate,Alwa,Samosa,Channa";

I need this as array like:

snacks= {"Chocolate,Alwa" , "Samosa,Channa"};
in C#.

Could anyone pls Suggest the way to find my 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++)
             for (int j=0;j<2;j++)