Rect.GetHashCode 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
為矩形建立雜湊碼。
public:
override int GetHashCode();
public override int GetHashCode();
override this.GetHashCode : unit -> int
Public Overrides Function GetHashCode () As Integer
傳回
目前結構的雜湊碼 Rect 。
範例
以下範例展示了如何使用該 GetHashCode 方法取得 的雜湊碼 Rect。
private int getHashCodeExample()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Get the hashcode of the rectangle.
int returnHashCode = myRectangle.GetHashCode();
return returnHashCode;
}
備註
此方法透過使用 X、 Y、 Width和 Height 屬性值來建立雜湊碼。