XPTable.Models.CellCollection.InsertRange C# (CSharp) Method

InsertRange() public method

Inserts an array of Cells into the collection at the specified index
public InsertRange ( int index, Cell cells ) : void
index int The zero-based index at which the cells should be inserted
cells Cell An array of Cells to be inserted into the collection
return void
        public void InsertRange(int index, Cell[] cells)
        {
            if (cells == null)
            {
                throw new System.ArgumentNullException("Cell[] is null");
            }

            if (index < 0)
            {
                throw new IndexOutOfRangeException();
            }

            if (index >= this.Count)
            {
                this.AddRange(cells);
            }
            else
            {
                for (int i=cells.Length-1; i>=0; i--)
                {
                    this.Insert(index, cells[i]);
                }
            }
        }