System.Data.ConstraintCollection.BaseRemove C# (CSharp) Method

BaseRemove() private method

Does verification on the constraint and it's name. An ArgumentNullException is thrown if this constraint is null. An ArgumentException is thrown if this constraint doesn't belong to this collection or if this constraint is part of a relationship.
private BaseRemove ( Constraint constraint ) : void
constraint Constraint
return void
        private void BaseRemove(Constraint constraint)
        {
            if (constraint == null)
            {
                throw ExceptionBuilder.ArgumentNull(nameof(constraint));
            }
            if (constraint.Table != _table)
            {
                throw ExceptionBuilder.ConstraintRemoveFailed();
            }

            UnregisterName(constraint.ConstraintName);
            constraint.InCollection = false;

            if (constraint is UniqueConstraint)
            {
                for (int i = 0; i < Table.ChildRelations.Count; i++)
                {
                    DataRelation rel = Table.ChildRelations[i];
                    if (rel.ParentKeyConstraint == constraint)
                        rel.SetParentKeyConstraint(null);
                }
                ((UniqueConstraint)constraint).ConstraintIndexClear();
            }
            else if (constraint is ForeignKeyConstraint)
            {
                for (int i = 0; i < Table.ParentRelations.Count; i++)
                {
                    DataRelation rel = Table.ParentRelations[i];
                    if (rel.ChildKeyConstraint == constraint)
                        rel.SetChildKeyConstraint(null);
                }
            }
        }