ערוך

שתף באמצעות


UniqueConstraint.Equals(Object) Method

Definition

Compares this constraint to a second to determine if both are identical.

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

Parameters

key2
Object

The object to which this UniqueConstraint is compared.

Returns

true, if the constraints are equal; otherwise, false.

Examples

The following example compares two UniqueConstraint objects.

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

Remarks

Two constraints are equal if they constrain the same columns.

Applies to

See also