Point4D.Equals 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
比较两个 Point4D 结构是否相等。
重载
Equals(Object) |
确定指定的 Object 是否为 Point4D 结构,以及指定的 Object 的 X、Y、Z 和 W 属性是否与此 Point4D 结构的 X、Y、Z 和 W 属性相等。 |
Equals(Point4D) |
比较两个 Point4D 结构是否相等。 |
Equals(Point4D, Point4D) |
比较两个 Point4D 结构是否相等。 |
Equals(Object)
public:
override bool Equals(System::Object ^ o);
public override bool Equals (object o);
override this.Equals : obj -> bool
Public Overrides Function Equals (o As Object) As Boolean
参数
- o
- Object
要比较的对象。
返回
如果两个实例相等,则为 true
;否则为 false
。
如果 o
(传递的 Object)为 Point4D 结构并且与此 Point4D 结构相同,则为 true
;否则为 false
。
示例
下面的示例演示如何检查一个 Object 和一个 Point4D 结构是否相等。
// Compares an Object and a Point4D for equality using the non-static Equals method.
Point4D point1 = new Point4D(10, 5, 1, 4);
Point4D point2 = new Point4D(15, 40, 60, 75);
Boolean areEqual;
areEqual = point1.Equals(point2);
// areEqual is False. point2 is a Point4D structure, but it is not equal to point1.
// Displaying Results
syntaxString = "areEqual = point1.Equals(point2);";
resultType = "Boolean";
operationString = "Checking if two 3D points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
' Compares an Object and a Point4D for equality using the non-static Equals method.
Dim point1 As New Point4D(10, 5, 1, 4)
Dim point2 As New Point4D(15, 40, 60, 75)
Dim areEqual As Boolean
areEqual = point1.Equals(point2)
' areEqual is False. point2 is a Point4D structure, but it is not equal to point1.
' Displaying Results
syntaxString = "areEqual = point1.Equals(point2)"
resultType = "Boolean"
operationString = "Checking if two 3D points are equal"
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString)
注解
如果 o
(传递的对象) 不是结构 Point4D ,此方法将 false
返回。
由于当对它们执行算术运算时,值 Double 可能会丢失精度,因此在逻辑上相等的两 Point4D 个值之间的比较可能会失败。
另请参阅
适用于
Equals(Point4D)
比较两个 Point4D 结构是否相等。
public:
bool Equals(System::Windows::Media::Media3D::Point4D value);
public bool Equals (System.Windows.Media.Media3D.Point4D value);
override this.Equals : System.Windows.Media.Media3D.Point4D -> bool
Public Function Equals (value As Point4D) As Boolean
参数
- value
- Point4D
要与此实例比较的 Point4D 实例。
返回
如果两个实例相等,则为 true
;否则为 false
。
注解
由于当对它们执行算术运算时,值 Double 可能会丢失精度,因此在逻辑上相等的两 Point4D 个值之间的比较可能会失败。
另请参阅
适用于
Equals(Point4D, Point4D)
比较两个 Point4D 结构是否相等。
public:
static bool Equals(System::Windows::Media::Media3D::Point4D point1, System::Windows::Media::Media3D::Point4D point2);
public static bool Equals (System.Windows.Media.Media3D.Point4D point1, System.Windows.Media.Media3D.Point4D point2);
static member Equals : System.Windows.Media.Media3D.Point4D * System.Windows.Media.Media3D.Point4D -> bool
Public Shared Function Equals (point1 As Point4D, point2 As Point4D) As Boolean
参数
返回
如果 point3D1
和 point3D2
的 X、Y 和 Z 分量相等,则为 true
;否则为 false
。
示例
以下示例演示如何检查两 Point4D 个结构是否相等。
// Checks if two Point4D structures are equal using the static Equals method.
// point1's x,y,z,w properties set when the structure is created
Point4D point1 = new Point4D(10, 5, 1, 4);
Point4D point2 = new Point4D();
Boolean areEqual;
// settting point2's x,y,z,w properties
point2.X = 15;
point2.Y = 40;
point2.Z = 60;
point2.W = 75;
areEqual = Point4D.Equals(point1, point2);
// areEqual is False
//Displaying Results
syntaxString = "areEqual = Point4D.Equals(point1, point2);";
resultType = "Boolean";
operationString = "Checking if 3D two points are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
' Checks if two Point4D structures are equal using the static Equals method.
' point1's x,y,z,w properties set when the structure is created
Dim point1 As New Point4D(10, 5, 1, 4)
Dim point2 As New Point4D()
Dim areEqual As Boolean
' settting point2's x,y,z,w properties
point2.X = 15
point2.Y = 40
point2.Z = 60
point2.W = 75
areEqual = Point4D.Equals(point1, point2)
' areEqual is False
'Displaying Results
syntaxString = "areEqual = Point4D.Equals(point1, point2)"
resultType = "Boolean"
operationString = "Checking if 3D two points are equal"
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString)
注解
Point4D如果两个结构的值和属性的值相同,ZW则两XY个结构相等。
由于 Double 当对它们执行算术运算时,值可能会丢失精度,因此在逻辑上相等的两 Point4D 个实例之间的比较可能会失败。