private void WriteFixedArray(Array arr, int constantStringLength, BinaryWriter writer)
        {
            // Fixed-size arrays have no header at all. Just all the values one after each other.
            for (var i = 0; i < arr.Length; i++)
            {
                var value = arr.GetValue(i);
                if (value == null)
                    value = arr.CreateElementInstance();

                Serialize(value, constantStringLength, writer);
            }
        }
        private void WriteArray2(Array arr, int constantStringLength, BinaryWriter writer)
        {
            // only dynamic, 0-based multidimensional arrays are supported.

            WriteArrayRank(2, writer);

            int i = arr.GetLength(0);
            int j = arr.GetLength(1);

            WriteArrayLength(j, 0, writer);
            WriteArrayLength(i, 0, writer);

            for (int jj = 0; jj < j; jj++)
            {
                for (int ii = 0; ii < i; ii++)
                {
                    var value = arr.GetValue(ii, jj);
                    if (value == null)
                        value = arr.CreateElementInstance();

                    Serialize(value, constantStringLength, writer);
                }
            }
        }