DependencyObject.Equals(Object) Method


确定提供的 DependencyObject 是否等效于当前 DependencyObjectDetermines whether a provided DependencyObject is equivalent to the current DependencyObject.

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



要与当前实例进行比较的 DependencyObjectThe DependencyObject to compare to the current instance.



如果两个实例相同,则为 true;否则为 falsetrue if the two instances are the same; otherwise, false.


此实现只是引用相等性,不会尝试计算所包含属性的值相等性。This implementation is reference equality only, and does not attempt to evaluate value equality of the contained properties.

Notes to Inheritors

DependencyObject 重写,然后密封两个基本 Object 方法: Equals(Object)GetHashCode() DependencyObject overrides and then seals two basic Object methods: Equals(Object) and GetHashCode(). 重写调用 Object 实现,导致对象相等性行为。The overrides call the Object implementations, resulting in an object equality behavior. 这些有意的替代的目的是防止派生类尝试为 DependencyObject定义值相等性。The purpose of these deliberate overrides is to prevent derived classes from trying to define a value equality for a DependencyObject. 由于 DependencyObject 及其依赖属性的原始属性值更改功能,DependencyObject 的值 equalities 将永远不准确。Value equalities for DependencyObject will never be accurate because of the innate property value-changing capabilities of a DependencyObject and its dependency properties. 这包括基本 [!INCLUDE[TLA2#tla_winclient](~/includes/] 功能,如数据绑定和 [!INCLUDE[TLA2#tla_winclient](~/includes/] 属性系统。This includes fundamental [!INCLUDE[TLA2#tla_winclient](~/includes/] features such as data binding and the [!INCLUDE[TLA2#tla_winclient](~/includes/] property system.

Applies to