Nyelv

ConstraintCollection.Remove Metódus

Definíció

Eltávolít egy Constraint elemet a ConstraintCollectionfájlból.

Túlterhelések

Name Description
Remove(Constraint)

Eltávolítja a megadottt Constraint a gyűjteményből.

Remove(String)

Eltávolítja a Constraint név alapján megadott objektumot a gyűjteményből.

Remove(Constraint)

Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs

Eltávolítja a megadottt Constraint a gyűjteményből.

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)

Paraméterek

constraint
Constraint

Az Constraint eltávolítandó.

Kivételek

Az constraint argumentum a következő null: .

A korlátozás nem tartozik a gyűjteményhez.

Példák

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

Megjegyzések

A metódus használata Remove előtt a metódussal Contains meghatározhatja, hogy a gyűjtemény tartalmazza-e a célt Constraint, és hogy a CanRemove metódus határozza meg, hogy eltávolítható-e a Constraint gyűjtemény.

Az CollectionChanged esemény akkor következik be, ha a kényszer sikeresen el lett távolítva.

Lásd még

A következőre érvényes:

Remove(String)

Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs
Forrás:
ConstraintCollection.cs

Eltávolítja a Constraint név alapján megadott objektumot a gyűjteményből.

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

Paraméterek

name
String

Az eltávolítani kívánt név Constraint .

Példák

Az alábbi példa eltávolít egy ConstraintConstraintCollection olyan esetet, amely a metódussal Contains való jelenlétét teszteli, és hogy eltávolítható-e a CanRemove metódussal.

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

Megjegyzések

A metódus használata Remove előtt a metódussal Contains meghatározhatja, hogy a gyűjtemény tartalmazza-e a célt Constraint, és hogy a CanRemove metódus határozza meg, hogy eltávolítható-e a Constraint gyűjtemény.

Az CollectionChanged esemény akkor következik be, ha a kényszer sikeresen el lett távolítva.

Lásd még

A következőre érvényes: