System.Runtime.Serialization.Formatters.Binary.IntSizedArray.IncreaseCapacity C# (CSharp) Method

IncreaseCapacity() private method

private IncreaseCapacity ( int index ) : void
index int
return void
        internal void IncreaseCapacity(int index)
        {
            try
            {
                if (index < 0)
                {
                    int size = Math.Max(_negObjects.Length * 2, (-index) + 1);
                    int[] newItems = new int[size];
                    Array.Copy(_negObjects, 0, newItems, 0, _negObjects.Length);
                    _negObjects = newItems;
                }
                else
                {
                    int size = Math.Max(_objects.Length * 2, index + 1);
                    int[] newItems = new int[size];
                    Array.Copy(_objects, 0, newItems, 0, _objects.Length);
                    _objects = newItems;
                }
            }
            catch (Exception)
            {
                throw new SerializationException(SR.Serialization_CorruptedStream);
            }
        }
    }