Creating a 2D array...

Hey. Is there a way to automatically convert a normal array into a 2D array? For example; if a normal array has 24 elements and I convert it to a 2D array that is 3x8, what was previously stored in array[0] will now be in 2Darray [0,0], array[5] becomes 2Darray[1,2], etc.

Thanks

Don’t know about something official but, this seems to work :

public static T[,] ConvertInto2DArray<T>( T[] inArray, int x, int y )
{
    if( inArray.Length != x * y ) return null;
	
    T[,] result = new T[x,y];
    for(int i = 0; i < x; i++)
        for(int j = 0; j < y; j++)
            result[ i, j ] = inArray[ i * y + j ];
	
    return result;
}