Point.Y 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
property double Y { double get(); void set(double value); };
public double Y { get; set; }
member this.Y : double with get, set
Public Property Y As Double
屬性值
範例
下列範例示範如何檢查兩 Point 個結構是否不相等。 它也說明如何在宣告結構時,以及在宣告結構之後,將值指派給 Point 結構。
// Checks if two Points are equal using the overloaded inequality operator.
private Boolean pointInequalityExample()
{
// Checks if two Points are not equal using the overloaded inequality operator.
// Declaring point1 and initializing x,y values
Point point1 = new Point(10, 5);
// Declaring point2 without initializing x,y values
Point point2 = new Point();
// Boolean to hold the result of the comparison
Boolean areNotEqual;
// assigning values to point2
point2.X = 15;
point2.Y = 40;
// Compare Point structures for equality.
// areNotEqual is True
areNotEqual = (point1 != point2);
return areNotEqual;
}
' Checks if two Points are equal using the overloaded inequality operator.
Private Function pointInequalityExample() As Boolean
' Checks if two Points are not equal using the overloaded inequality operator.
' Declaring point1 and initializing x,y values
Dim point1 As New Point(10, 5)
' Declaring point2 without initializing x,y values
Dim point2 As New Point()
' Boolean to hold the result of the comparison
Dim areNotEqual As Boolean
' assigning values to point2
point2.X = 15
point2.Y = 40
' Compare Point structures for equality.
' areNotEqual is True
areNotEqual = (point1 <> point2)
Return areNotEqual
End Function