在Point和PointF类中可用的功能之一是Equals()方法。 此方法用于比较两点的x和y坐标,并返回一个布尔值。
重要的是要注意,这个方法只能用于同类的Point对象。 尝试使用此方法比较不同类的两点,例如比较Point和PointF类时,会在运行时抛出NullReferenceException异常。
using IronSoftware.Drawing;
using System;
// Instantiate 2 points using float parameter
PointF pointFloat = new PointF(22.2f, 25.7f);
PointF pointFloat2 = new PointF(30.2f, 55.7f);
// Check for equality of the double parameter between 2 points
Console.WriteLine(pointFloat.Equals(pointFloat2));
Imports IronSoftware.Drawing
Imports System
' Instantiate 2 points using float parameter
Dim pointFloat As New PointF(22.2F, 25.7F)
Dim pointFloat2 As New PointF(30.2F, 55.7F)
' Check for equality of the double parameter between 2 points
Console.WriteLine(pointFloat.Equals(pointFloat2))Imports IronSoftware.Drawing Imports System ' Instantiate 2 points using float parameter Dim pointFloat As New PointF(22.2F, 25.7F) Dim pointFloat2 As New PointF(30.2F, 55.7F) ' Check for equality of the double parameter between 2 points Console.WriteLine(pointFloat.Equals(pointFloat2))
在Point和PointF类中可用的功能之一是Equals()方法。 此方法用于比较两点的x和y坐标,并返回一个布尔值。
重要的是要注意,这个方法只能用于同类的Point对象。 尝试使用此方法比较不同类的两点,例如比较Point和PointF类时,会在运行时抛出NullReferenceException异常。
NuGet 下载量 21,851,269|版本:2026.11刚刚发布