ConstraintCollection.Remove Metoda

Definice

Odebere objekt Constraint z objektu ConstraintCollection.

Přetížení

Remove(Constraint)

Odebere zadaný Constraint objekt z kolekce.

Remove(String)

Odebere Constraint objekt zadaný názvem z kolekce.

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

Chcete-li Constraint 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 určit, zda Constraint lze odebrat.

K CollectionChanged události dojde, pokud je omezení úspěšně odebráno.

Viz také

Platí pro

Remove(String)

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

Odebere Constraint objekt zadaný názvem z kolekce.

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 Contains pomocí metody a to, jestli je možné ho CanRemove pomocí metody odebrat.

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 určit, zda Constraint lze odebrat.

K CollectionChanged události dojde, pokud je omezení úspěšně odebráno.

Viz také

Platí pro