Vector.X Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the X component of this vector.
public:
property double X { double get(); void set(double value); };
public double X { get; set; }
member this.X : double with get, set
Public Property X As Double
Property Value
The X component of this vector. The default value is 0.
Examples
The following example shows how to check two Vector structures for equality.
// 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
Applies to
See also
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.