다음을 통해 공유


Vector.Y 속성

정의

이 벡터의 Y 구성 요소를 가져오거나 설정합니다.

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

속성 값

Double

이 벡터의 Y 구성 요소입니다. 기본값은 0입니다.

예제

다음 예제에서는 두 개를 선택 하는 방법을 보여 줍니다 Vector 구조체가 같은지 여부.

// Checks if two Vectors are equal using the overloaded equality operator.
private Boolean vectorEqualityExample()
{

    // Declaring vecto1 and initializing x,y values
    Vector vector1 = new Vector(20, 30);

    // Declaring vector2 without initializing x,y values
    Vector vector2 = new Vector();

    // Boolean to hold the result of the comparison
    Boolean areEqual;

    // assigning values to vector2
    vector2.X = 45;
    vector2.Y = 70;

    // Comparing Vectors for equality
    // areEqual is False
    areEqual = (vector1 == vector2);

    return areEqual;
}
' Checks if two Vectors are equal using the overloaded equality operator.
Private Function vectorEqualityExample() As Boolean

    ' Declaring vecto1 and initializing x,y values
    Dim vector1 As New Vector(20, 30)

    ' Declaring vector2 without initializing x,y values
    Dim vector2 As New Vector()

    ' Boolean to hold the result of the comparison
    Dim areEqual As Boolean

    ' assigning values to vector2
    vector2.X = 45
    vector2.Y = 70

    ' Comparing Vectors for equality
    ' areEqual is False
    areEqual = (vector1 = vector2)

    Return areEqual

End Function

적용 대상

추가 정보