Esempio n. 1
0
        // Token: 0x06001752 RID: 5970 RVA: 0x0006E580 File Offset: 0x0006C780
        private static void CopyFromJaggedToMultidimensionalArray(IList values, Array multidimensionalArray, int[] indices)
        {
            int num = indices.Length;

            if (num == multidimensionalArray.Rank)
            {
                multidimensionalArray.SetValue(Class_510.JaggedArrayGetValue(values, indices), indices);
                return;
            }
            int   length = multidimensionalArray.GetLength(num);
            IList list   = (IList)Class_510.JaggedArrayGetValue(values, indices);
            int   count  = list.Count;

            if (count != length)
            {
                throw new Exception("Cannot deserialize non-cubical array as multidimensional array.");
            }
            int[] array = new int[num + 1];
            for (int i = 0; i < num; i++)
            {
                array[i] = indices[i];
            }
            for (int j = 0; j < multidimensionalArray.GetLength(num); j++)
            {
                array[num] = j;
                Class_510.CopyFromJaggedToMultidimensionalArray(values, multidimensionalArray, array);
            }
        }
Esempio n. 2
0
        // Token: 0x06001754 RID: 5972 RVA: 0x0006E670 File Offset: 0x0006C870
        public static Array ToMultidimensionalArray(IList values, Type type, int rank)
        {
            IList <int> dimensions = Class_510.GetDimensions(values, rank);

            while (dimensions.Count < rank)
            {
                dimensions.Add(0);
            }
            Array array = Array.CreateInstance(type, dimensions.ToArray <int>());

            Class_510.CopyFromJaggedToMultidimensionalArray(values, array, new int[0]);
            return(array);
        }