UniqueConstraint.Equals(Object) Método

Definición

Compara esta restricción con una segunda para determinar si ambas son idénticas.

public:
 override bool Equals(System::Object ^ key2);
public override bool Equals (object? key2);
public override bool Equals (object key2);
override this.Equals : obj -> bool
Public Overrides Function Equals (key2 As Object) As Boolean

Parámetros

key2
Object

Objeto con el que se compara este UniqueConstraint.

Devoluciones

true si las restricciones son iguales; en caso contrario, false.

Ejemplos

En el ejemplo siguiente se comparan dos objetos UniqueConstraint.

Private Sub CompareConstraints()
    Dim constraintCustomerOrders As UniqueConstraint
    Dim constraintOrderDetails As UniqueConstraint
    Dim relationCustomerOrders As DataRelation
    Dim relationOrderDetails As DataRelation

    ' Get a DataRelation from a DataSet.
    relationCustomerOrders = DataSet1.Relations("CustomerOrders")

    '  Get a constraint.
    constraintCustomerOrders = relationCustomerOrders.ParentKeyConstraint

    ' Get a second relation and constraint.
    relationOrderDetails = DataSet1.Relations("OrderDetails")
    constraintOrderDetails = relationOrderDetails.ParentKeyConstraint

    ' Compare the two.
    Console.WriteLine( _
        constraintCustomerOrders.Equals(constraintOrderDetails).ToString())
 End Sub

Comentarios

Dos restricciones son iguales si restringen las mismas columnas.

Se aplica a

Consulte también