System.Collections.ArrayList.IListWrapper.InsertRange C# (CSharp) Method

InsertRange() public method

public InsertRange ( int index, ICollection c ) : void
index int
c ICollection
return void
            public override void InsertRange(int index, ICollection c)
            {
                if (c == null)
                    throw new ArgumentNullException(nameof(c), SR.ArgumentNull_Collection);
                if (index < 0 || index > Count) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
                Contract.EndContractBlock();

                if (c.Count > 0)
                {
                    ArrayList al = _list as ArrayList;
                    if (al != null)
                    {
                        // We need to special case ArrayList. 
                        // When c is a range of _list, we need to handle this in a special way.
                        // See ArrayList.InsertRange for details.
                        al.InsertRange(index, c);
                    }
                    else
                    {
                        IEnumerator en = c.GetEnumerator();
                        while (en.MoveNext())
                        {
                            _list.Insert(index++, en.Current);
                        }
                    }
                    _version++;
                }
            }