System.Data.DataColumnCollection.AddAt C# (CSharp) Méthode

AddAt() private méthode

private AddAt ( int index, DataColumn column ) : void
index int
column DataColumn
Résultat void
        internal void AddAt(int index, DataColumn column)
        {
            if (column != null && column.ColumnMapping == MappingType.SimpleContent)
            {
                if (_table.XmlText != null && _table.XmlText != column)
                {
                    throw ExceptionBuilder.CannotAddColumn3();
                }

                if (_table.ElementColumnCount > 0)
                {
                    throw ExceptionBuilder.CannotAddColumn4(column.ColumnName);
                }

                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, column));
                BaseAdd(column);
                if (index != -1)
                {
                    ArrayAdd(index, column);
                }
                else
                {
                    ArrayAdd(column);
                }

                _table.XmlText = column;
            }
            else
            {
                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, column));
                BaseAdd(column);
                if (index != -1)
                {
                    ArrayAdd(index, column);
                }
                else
                {
                    ArrayAdd(column);
                }

                // if the column is an element increase the internal dataTable counter
                if (column.ColumnMapping == MappingType.Element)
                {
                    _table.ElementColumnCount++;
                }
            }
            if (!_table.fInitInProgress && column != null && column.Computed)
            {
                column.Expression = column.Expression;
            }
            OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column));
        }