UniqueConstraint.Equals(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.