ConstraintCollection.Remove Metoda

Definice

Odebere z objektu ConstraintConstraintCollection.

Přetížení

Remove(Constraint)

Odebere zadaný Constraint objekt z kolekce.

Remove(String)

Odebere Constraint z kolekce objekt určený názvem.

Remove(Constraint)

Zdroj:
ConstraintCollection.cs
Zdroj:
ConstraintCollection.cs
Zdroj:
ConstraintCollection.cs

Odebere zadaný Constraint objekt z kolekce.

public:
 void Remove(System::Data::Constraint ^ constraint);
public void Remove (System.Data.Constraint constraint);
member this.Remove : System.Data.Constraint -> unit
Public Sub Remove (constraint As Constraint)

Parametry

constraint
Constraint

Objekt, Constraint který se má odebrat.

Výjimky

Argument constraint je null.

Omezení nepatří do kolekce.

Příklady

private void RemoveConstraint(DataTable table,
    Constraint constraint)
{
    if(table.Constraints.Contains(constraint.ConstraintName))
        if(table.Constraints.CanRemove(constraint))
            table.Constraints.Remove(constraint);
}
Private Sub RemoveConstraint(table As DataTable, _
    constraint As Constraint)

    If table.Constraints.Contains(constraint.ConstraintName) Then
        If table.Constraints.CanRemove(constraint) Then
            table.Constraints.Remove(constraint)
        End If
    End If
End Sub

Poznámky

Před použitím Remove metody můžete použít metodu Contains k určení, zda kolekce obsahuje cíl Constraint, a metodu CanRemove k určení, zda Constraint lze odebrat .

Událost CollectionChanged nastane, pokud je omezení úspěšně odebráno.

Viz také

Platí pro

Remove(String)

Zdroj:
ConstraintCollection.cs
Zdroj:
ConstraintCollection.cs
Zdroj:
ConstraintCollection.cs

Odebere Constraint z kolekce objekt určený názvem.

public:
 void Remove(System::String ^ name);
public void Remove (string name);
member this.Remove : string -> unit
Public Sub Remove (name As String)

Parametry

name
String

Název objektu, který Constraint chcete odebrat.

Příklady

Následující příklad odebere Constraint z objektu ConstraintCollection po otestování jeho přítomnosti s metodou Contains a zda lze odebrat pomocí CanRemove metody .

private void RemoveConstraint(ConstraintCollection constraints,
    Constraint constraint)
{
    if(constraints.Contains(constraint.ConstraintName))
        if(constraints.CanRemove(constraint))
            constraints.Remove(constraint.ConstraintName);
}
Private Sub RemoveConstraint _
    (constraints As ConstraintCollection, constraint As Constraint)

    If constraints.Contains(constraint.ConstraintName) Then
        If constraints.CanRemove(constraint) Then
            constraints.Remove(constraint.ConstraintName)
        End If
    End If
End Sub

Poznámky

Před použitím Remove metody můžete použít metodu Contains k určení, zda kolekce obsahuje cíl Constraint, a metodu CanRemove k určení, zda Constraint lze odebrat .

Událost CollectionChanged nastane, pokud je omezení úspěšně odebráno.

Viz také

Platí pro