UniqueConstraint.Equals(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將這個條件約束和第二個條件約束相比較,以判斷兩者是否相同。
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
參數
- key2
- Object
這個 UniqueConstraint 所要比較的物件。
傳回
若兩個條件約束相等,則為 true
;否則為 false
。
範例
下列範例會比較兩個 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
備註
如果兩個條件約束限制相同的數據行,則兩個條件約束相等。