IRONSOFTWAREHOME
取得 Hash Code
using IronSoftware.Drawing;
using System;

PointF pointFloat = new PointF(22.2f, 25.7f);

int hashCode = pointFloat.GetHashCode();

// Output hash code value of this point
Console.WriteLine(hashCode);
NuGet Download
PM > Install-Package IronSoftware.System.Drawing
取得 Hash Code

取得 Hash Code

IronDrawing 中的 Point 和 PointF 類別另有一個可用的方法是 GetHashCode() 方法。 雜湊碼是一種數值,能以獨特的方式代表一個物件的身份,例如 Point。 雜湊碼通常用於字典、雜湊集和雜湊表中,以促進物件相等性和雜湊操作。

要獲得 Point 的雜湊碼,只需在已實例化的 Point 或 PointF 物件上調用 GetHashCode() 方法。 方法返回一個 System.Int32 物件,可以列印或儲存。

可以使用 GetHashCode() 和 Equals() 方法來比較兩個點的等同性。 然而,Equals() 方法提供直接的等同性檢查結果,而 GetHashCode() 方法主要用於獲得點的雜湊碼,隨後在像字典或雜湊表這樣的資料結構中使用。

在GitHub上查看

準備開始了嗎?

Nuget Downloads 20,274,271版本:2025.3剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰。

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronDrawing
獲取您的無義務諮詢
您的詳細資訊將始終保密。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
被全球數百萬工程師信任
立即獲取您的30天試用金鑰。
無需信用卡或帳戶建立